summaryrefslogtreecommitdiffstats
path: root/base/files
diff options
context:
space:
mode:
authorcraig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-05 15:15:01 +0000
committercraig.schlenter@chromium.org <craig.schlenter@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-05 15:15:01 +0000
commit7a490c1c7c02c17c43d067c9543a19d059e5ac7f (patch)
tree8d5ddfd331a8d8a3b2c748c28dd53d42f3d26d0a /base/files
parentb9f2c11e88b7d090051233fc37c7f31991e9cafd (diff)
downloadchromium_src-7a490c1c7c02c17c43d067c9543a19d059e5ac7f.zip
chromium_src-7a490c1c7c02c17c43d067c9543a19d059e5ac7f.tar.gz
chromium_src-7a490c1c7c02c17c43d067c9543a19d059e5ac7f.tar.bz2
[Coverity] Check return value.
CID=101407 BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/9956064 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/files')
-rw-r--r--base/files/file_path_watcher_linux.cc35
1 files changed, 18 insertions, 17 deletions
diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc
index d1b811d..72c8610c 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -436,23 +436,24 @@ bool FilePathWatcherImpl::UpdateWatches() {
if ((watch_entry->watch_ == InotifyReader::kInvalidWatch) &&
file_util::IsLink(path)) {
FilePath link;
- file_util::ReadSymbolicLink(path, &link);
- if (!link.IsAbsolute())
- link = path.DirName().Append(link);
- // Try watching symlink target directory. If the link target is "/",
- // then we shouldn't get here in normal situations and if we do, we'd
- // watch "/" for changes to a component "/" which is harmless so no
- // special treatment of this case is required.
- watch_entry->watch_ =
- g_inotify_reader.Get().AddWatch(link.DirName(), this);
- if (watch_entry->watch_ != InotifyReader::kInvalidWatch) {
- watch_entry->linkname_ = link.BaseName().value();
- } else {
- DPLOG(WARNING) << "Watch failed for " << link.DirName().value();
- // TODO(craig) Symlinks only work if the parent directory
- // for the target exist. Ideally we should make sure we've
- // watched all the components of the symlink path for
- // changes. See crbug.com/91561 for details.
+ if (file_util::ReadSymbolicLink(path, &link)) {
+ if (!link.IsAbsolute())
+ link = path.DirName().Append(link);
+ // Try watching symlink target directory. If the link target is "/",
+ // then we shouldn't get here in normal situations and if we do, we'd
+ // watch "/" for changes to a component "/" which is harmless so no
+ // special treatment of this case is required.
+ watch_entry->watch_ =
+ g_inotify_reader.Get().AddWatch(link.DirName(), this);
+ if (watch_entry->watch_ != InotifyReader::kInvalidWatch) {
+ watch_entry->linkname_ = link.BaseName().value();
+ } else {
+ DPLOG(WARNING) << "Watch failed for " << link.DirName().value();
+ // TODO(craig) Symlinks only work if the parent directory
+ // for the target exist. Ideally we should make sure we've
+ // watched all the components of the symlink path for
+ // changes. See crbug.com/91561 for details.
+ }
}
}
if (watch_entry->watch_ == InotifyReader::kInvalidWatch) {