summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 09:56:28 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-06 09:56:28 +0000
commit6ae340f0f9bc186240d847b40d547a0b5c6e7824 (patch)
tree3e0d50449e648ed4edc9b60e588b93dcbef27939 /base
parentc751031b5436fcc12c6160f531a5c515164f08e9 (diff)
downloadchromium_src-6ae340f0f9bc186240d847b40d547a0b5c6e7824.zip
chromium_src-6ae340f0f9bc186240d847b40d547a0b5c6e7824.tar.gz
chromium_src-6ae340f0f9bc186240d847b40d547a0b5c6e7824.tar.bz2
Cleanup in {test_,}file_util_posix.cc
- DCHECK_EQ instead of DCHECK(foo == bar) - more detailed log error messages - add a comment why we use 0777 permissions for new dirs (umask should produce sane permissions) Review URL: http://codereview.chromium.org/40162 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/file_util_posix.cc9
-rw-r--r--base/test_file_util_posix.cc7
2 files changed, 10 insertions, 6 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 6d3984e..85cdc10 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -142,7 +142,7 @@ bool CopyDirectory(const FilePath& from_path,
std::string suffix(&ent->fts_path[from_path.value().size()]);
// Strip the leading '/' (if any).
if (!suffix.empty()) {
- DCHECK(suffix[0] == '/');
+ DCHECK_EQ('/', suffix[0]);
suffix.erase(0, 1);
}
const FilePath target_path = to_path.Append(suffix);
@@ -157,6 +157,7 @@ bool CopyDirectory(const FilePath& from_path,
}
// Try creating the target dir, continuing on it if it exists already.
+ // Rely on the user's umask to produce correct permissions.
if (mkdir(target_path.value().c_str(), 0777) != 0) {
if (errno != EEXIST)
error = errno;
@@ -185,10 +186,12 @@ bool CopyDirectory(const FilePath& from_path,
break;
case FTS_SL: // Symlink.
case FTS_SLNONE: // Symlink with broken target.
- LOG(WARNING) << "CopyDirectory() skipping symbolic link.";
+ LOG(WARNING) << "CopyDirectory() skipping symbolic link: " <<
+ ent->fts_path;
continue;
case FTS_DEFAULT: // Some other sort of file.
- LOG(WARNING) << "CopyDirectory() skipping weird file.";
+ LOG(WARNING) << "CopyDirectory() skipping file of unknown type: " <<
+ ent->fts_path;
continue;
default:
NOTREACHED();
diff --git a/base/test_file_util_posix.cc b/base/test_file_util_posix.cc
index f55421c..38aaae2 100644
--- a/base/test_file_util_posix.cc
+++ b/base/test_file_util_posix.cc
@@ -44,13 +44,14 @@ bool CopyRecursiveDirNoCache(const std::wstring& source_dir,
std::string suffix(&ent->fts_path[from_path.value().size()]);
// Strip the leading '/' (if any).
if (!suffix.empty()) {
- DCHECK(suffix[0] == '/');
+ DCHECK_EQ('/', suffix[0]);
suffix.erase(0, 1);
}
const FilePath target_path = to_path.Append(suffix);
switch (ent->fts_info) {
case FTS_D: // Preorder directory.
// Try creating the target dir, continuing on it if it exists already.
+ // Rely on the user's umask to produce correct permissions.
if (mkdir(target_path.value().c_str(), 0777) != 0) {
if (errno != EEXIST)
error = errno;
@@ -87,10 +88,10 @@ bool CopyRecursiveDirNoCache(const std::wstring& source_dir,
break;
case FTS_SL: // Symlink.
case FTS_SLNONE: // Symlink with broken target.
- LOG(WARNING) << "skipping symbolic link.";
+ LOG(WARNING) << "skipping symbolic link: " << ent->fts_path;
continue;
case FTS_DEFAULT: // Some other sort of file.
- LOG(WARNING) << "skipping weird file.";
+ LOG(WARNING) << "skipping file of unknown type: " << ent->fts_path;
continue;
default:
NOTREACHED();