summaryrefslogtreecommitdiffstats
path: root/base/logging.cc
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-10 23:28:46 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-10 23:28:46 +0000
commitac577490a5c20950f63d655de37058dc41486e99 (patch)
treee5a53f6cad3317c2451f8ef39bf0b19bd8706e79 /base/logging.cc
parent0f1169993f28f8da9be5a81496fb2e2abf311387 (diff)
downloadchromium_src-ac577490a5c20950f63d655de37058dc41486e99.zip
chromium_src-ac577490a5c20950f63d655de37058dc41486e99.tar.gz
chromium_src-ac577490a5c20950f63d655de37058dc41486e99.tar.bz2
Revert 18109, 18111: Windows UI tests failed.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18112 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/logging.cc')
-rw-r--r--base/logging.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/base/logging.cc b/base/logging.cc
index b5af671..77e9583 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -19,9 +19,12 @@ typedef HANDLE MutexHandle;
#endif
#if defined(OS_POSIX)
+#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
#include <unistd.h>
#define MAX_PATH PATH_MAX
typedef FILE* FileHandle;
@@ -37,6 +40,7 @@ typedef pthread_mutex_t* MutexHandle;
#include "base/command_line.h"
#include "base/debug_util.h"
#include "base/lock_impl.h"
+#include "base/reserved_file_descriptors.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "base/sys_string_conversions.h"
@@ -204,6 +208,20 @@ bool InitializeLogFileHandle() {
}
}
SetFilePointer(log_file, 0, 0, FILE_END);
+#elif defined(OS_LINUX)
+ // Reserve global fd slots.
+ int reserved_fds[kReservedFds];
+ for (int i=0; i < kReservedFds; i++)
+ reserved_fds[i] = open("/dev/null", O_RDONLY, 0);
+
+ log_file = fopen(log_file_name->c_str(), "a");
+
+ // Release the reserved fds.
+ for (int i=0; i < kReservedFds; i++)
+ close(reserved_fds[i]);
+
+ if (log_file == NULL)
+ return false;
#elif defined(OS_POSIX)
log_file = fopen(log_file_name->c_str(), "a");
if (log_file == NULL)