diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 17:33:06 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-21 17:33:06 +0000 |
commit | 5d6018f9e3f61d45475fc1d2592a390bbe828ce8 (patch) | |
tree | cf56cd38fa994849308acddbc4bcade2d5473138 /base | |
parent | bc384e4a3dbbc1accc47f14368db23e37ab5f3b5 (diff) | |
download | chromium_src-5d6018f9e3f61d45475fc1d2592a390bbe828ce8.zip chromium_src-5d6018f9e3f61d45475fc1d2592a390bbe828ce8.tar.gz chromium_src-5d6018f9e3f61d45475fc1d2592a390bbe828ce8.tar.bz2 |
Linux, Mac: Don't test parent directories when checking if a path is writable.
This additional check has existed since the code was first written, but wtc
queried it in [1] and noted that it doesn't match the Windows version.
[1] http://codereview.chromium.org/541022/diff/1/3#newcode309
Removing this additional test doesn't break any unittests so it looks
like we can match the Windows code here.
http://codereview.chromium.org/545156
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@36760 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/file_util_posix.cc | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 579e79a..0436c73 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -306,14 +306,8 @@ bool PathExists(const FilePath& path) { bool PathIsWritable(const FilePath& path) { FilePath test_path(path); stat_wrapper_t file_info; - if (CallStat(test_path.value().c_str(), &file_info) != 0) { - // If the path doesn't exist, test the parent dir. - test_path = test_path.DirName(); - // If the parent dir doesn't exist, then return false (the path is not - // directly writable). - if (CallStat(test_path.value().c_str(), &file_info) != 0) - return false; - } + if (CallStat(test_path.value().c_str(), &file_info) != 0) + return false; if (S_IWOTH & file_info.st_mode) return true; if (getegid() == file_info.st_gid && (S_IWGRP & file_info.st_mode)) |