Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: base/file_util_posix.cc

Issue 10690047: Fix a bug in file_util::Delete() where symlinks are not handled right (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync & add comment Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index c9a0d9bb474c2d8e6f15321b67c72999f1153b66..e3bab95dd8e32554c81d8b41466909e5406e0027 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -207,7 +207,7 @@ bool Delete(const FilePath& path, bool recursive) {
base::ThreadRestrictions::AssertIOAllowed();
const char* path_str = path.value().c_str();
stat_wrapper_t file_info;
- int test = CallStat(path_str, &file_info);
+ int test = CallLstat(path_str, &file_info);
if (test != 0) {
// The Windows version defines this condition as success.
bool ret = (errno == ENOENT || errno == ENOTDIR);
@@ -578,10 +578,10 @@ bool CreateDirectory(const FilePath& full_path) {
// TODO(rkc): Refactor GetFileInfo and FileEnumerator to handle symlinks
// correctly. http://code.google.com/p/chromium-os/issues/detail?id=15948
bool IsLink(const FilePath& file_path) {
- struct stat st;
+ stat_wrapper_t st;
// If we can't lstat the file, it's safe to assume that the file won't at
// least be a 'followable' link.
- if (lstat(file_path.value().c_str(), &st) != 0)
+ if (CallLstat(file_path.value().c_str(), &st) != 0)
return false;
if (S_ISLNK(st.st_mode))
« no previous file with comments | « base/file_util.h ('k') | base/file_util_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698