Skip to content

Commit

Permalink
Fix nits in base/files/file_util_posix.cc.
Browse files Browse the repository at this point in the history
Change-Id: Id883d962d14233db330a28d972c500fc8a502c06
Reviewed-on: https://chromium-review.googlesource.com/1056317
Reviewed-by: Thomas Anderson <thomasanderson@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#558105}
  • Loading branch information
leizleiz authored and Commit Bot committed May 12, 2018
1 parent 684f55e commit eb210e9
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions base/files/file_util_posix.cc
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,24 @@ namespace {

#if defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) || \
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();
return stat(path, sb);
}
static int CallLstat(const char *path, stat_wrapper_t *sb) {
int CallLstat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed();
return lstat(path, sb);
}
#else // defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL) ||
// defined(OS_ANDROID) && __ANDROID_API__ < 21
static int CallStat(const char *path, stat_wrapper_t *sb) {
#else
int CallStat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed();
return stat64(path, sb);
}
static int CallLstat(const char *path, stat_wrapper_t *sb) {
int CallLstat(const char* path, stat_wrapper_t* sb) {
AssertBlockingAllowed();
return lstat64(path, sb);
}
#endif // !(defined(OS_BSD) || defined(OS_MACOSX) || defined(OS_NACL))
#endif

#if !defined(OS_NACL_NONSFI)
// Helper for VerifyPathControlledByUser.
Expand Down Expand Up @@ -291,7 +290,7 @@ bool DoCopyDirectory(const FilePath& from_path,
}

// 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()) {
DPLOG(ERROR) << "CopyDirectory() couldn't open file: " << current.value();
return false;
Expand Down Expand Up @@ -331,7 +330,7 @@ bool DoCopyDirectory(const FilePath& from_path,
#else
int mode = 0600;
#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()) {
DPLOG(ERROR) << "CopyDirectory() couldn't create file: "
<< target_path.value();
Expand Down Expand Up @@ -390,7 +389,7 @@ bool DeleteFile(const FilePath& path, bool recursive) {
return (rmdir(path_str) == 0);

bool success = true;
base::stack<std::string> directories;
stack<std::string> directories;
directories.push(path.value());
FileEnumerator traversal(path, true,
FileEnumerator::FILES | FileEnumerator::DIRECTORIES |
Expand Down Expand Up @@ -619,14 +618,15 @@ bool GetTempDir(FilePath* path) {
const char* tmp = getenv("TMPDIR");
if (tmp) {
*path = FilePath(tmp);
} else {
return true;
}

#if defined(OS_ANDROID)
return PathService::Get(base::DIR_CACHE, path);
return PathService::Get(DIR_CACHE, path);
#else
*path = FilePath("/tmp");
#endif
}
*path = FilePath("/tmp");
return true;
#endif
}
#endif // !defined(OS_MACOSX)

Expand Down

0 comments on commit eb210e9

Please sign in to comment.