From e131cf56c776248bb22d234ad806aafb64869e5a Mon Sep 17 00:00:00 2001 From: "evan@chromium.org" Date: Thu, 25 Mar 2010 19:10:28 +0000 Subject: posix: stat() uses errno, not its return value, for errors l/stat() always return -1 on error, so we must examine errno if we want to handle errors specially. (This is only used for judging whether to print an error message, so it's not too harmful.) TEST=symlink to nowhere in a dir; Chrome should not complain about that symlink when enumerating files in the directory Review URL: http://codereview.chromium.org/1352001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42647 0039d316-1c4b-4281-b951-d872f2087c98 --- base/file_util_posix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'base/file_util_posix.cc') diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 4a86261..2047636 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -659,7 +659,7 @@ bool FileEnumerator::ReadDirectory(std::vector* entries, if (ret < 0) { // Print the stat() error message unless it was ENOENT and we're // following symlinks. - if (!(ret == ENOENT && !show_links)) { + if (!(errno == ENOENT && !show_links)) { PLOG(ERROR) << "Couldn't stat " << source.Append(dent->d_name).value(); } -- cgit v1.1