Commit eb210e93 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Fix nits in base/files/file_util_posix.cc.

Change-Id: Id883d962d14233db330a28d972c500fc8a502c06
Reviewed-on: https://chromium-review.googlesource.com/1056317Reviewed-by: default avatarThomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558105}
parent 684f55e0
...@@ -70,25 +70,24 @@ namespace { ...@@ -70,25 +70,24 @@ namespace {
#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \ #if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
defined(OS_ANDROID) && __ANDROID_API__ < 21 defined(OS_ANDROID) && __ANDROID_API__ < 21
static int CallStat(const char *path, stat_wrapper_t *sb) { int CallStat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed(); AssertBlockingAllowed();
return stat(path, sb); return stat(path, sb);
} }
static int CallLstat(const char *path, stat_wrapper_t *sb) { int CallLstat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed(); AssertBlockingAllowed();
return lstat(path, sb); return lstat(path, sb);
} }
#else // defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || #else
// defined(OS_ANDROID) && __ANDROID_API__ < 21 int CallStat(const char* path, stat_wrapper_t* sb) {
static int CallStat(const char *path, stat_wrapper_t *sb) {
AssertBlockingAllowed(); AssertBlockingAllowed();
return stat64(path, sb); return stat64(path, sb);
} }
static int CallLstat(const char *path, stat_wrapper_t *sb) { int CallLstat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed(); AssertBlockingAllowed();
return lstat64(path, sb); return lstat64(path, sb);
} }
#endif // !(defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL)) #endif
#if !defined(OS_NACL_NONSFI) #if !defined(OS_NACL_NONSFI)
// Helper for VerifyPathControlledByUser. // Helper for VerifyPathControlledByUser.
...@@ -291,7 +290,7 @@ bool DoCopyDirectory(const FilePath& from_path, ...@@ -291,7 +290,7 @@ bool DoCopyDirectory(const FilePath& from_path,
} }
// Add O_NONBLOCK so we can't block opening a pipe. // Add O_NONBLOCK so we can't block opening a pipe.
base::File infile(open(current.value().c_str(), O_RDONLY | O_NONBLOCK)); File infile(open(current.value().c_str(), O_RDONLY | O_NONBLOCK));
if (!infile.IsValid()) { if (!infile.IsValid()) {
DPLOG(ERROR) << "CopyDirectory() couldn't open file: " << current.value(); DPLOG(ERROR) << "CopyDirectory() couldn't open file: " << current.value();
return false; return false;
...@@ -331,7 +330,7 @@ bool DoCopyDirectory(const FilePath& from_path, ...@@ -331,7 +330,7 @@ bool DoCopyDirectory(const FilePath& from_path,
#else #else
int mode = 0600; int mode = 0600;
#endif #endif
base::File outfile(open(target_path.value().c_str(), open_flags, mode)); File outfile(open(target_path.value().c_str(), open_flags, mode));
if (!outfile.IsValid()) { if (!outfile.IsValid()) {
DPLOG(ERROR) << "CopyDirectory() couldn't create file: " DPLOG(ERROR) << "CopyDirectory() couldn't create file: "
<< target_path.value(); << target_path.value();
...@@ -390,7 +389,7 @@ bool DeleteFile(const FilePath& path, bool recursive) { ...@@ -390,7 +389,7 @@ bool DeleteFile(const FilePath& path, bool recursive) {
return (rmdir(path_str) == 0); return (rmdir(path_str) == 0);
bool success = true; bool success = true;
base::stack<std::string> directories; stack<std::string> directories;
directories.push(path.value()); directories.push(path.value());
FileEnumerator traversal(path, true, FileEnumerator traversal(path, true,
FileEnumerator::FILES | FileEnumerator::DIRECTORIES | FileEnumerator::FILES | FileEnumerator::DIRECTORIES |
...@@ -619,14 +618,15 @@ bool GetTempDir(FilePath* path) { ...@@ -619,14 +618,15 @@ bool GetTempDir(FilePath* path) {
const char* tmp = getenv("TMPDIR"); const char* tmp = getenv("TMPDIR");
if (tmp) { if (tmp) {
*path = FilePath(tmp); *path = FilePath(tmp);
} else { return true;
}
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
return PathService::Get(base::DIR_CACHE, path); return PathService::Get(DIR_CACHE, path);
#else #else
*path = FilePath("/tmp"); *path = FilePath("/tmp");
#endif
}
return true; return true;
#endif
} }
#endif // !defined(OS_MACOSX) #endif // !defined(OS_MACOSX)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment