From 90a61b6babe3528efd982511790057e1e1e39b81 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sat, 28 Feb 2015 20:42:50 +0100 Subject: fs/FileInfo: new library providing GetFileInfo() Replaces StatFile(), with a portable data object. --- src/db/update/InotifyUpdate.cxx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src/db/update') diff --git a/src/db/update/InotifyUpdate.cxx b/src/db/update/InotifyUpdate.cxx index 42423e07e..f699b7f78 100644 --- a/src/db/update/InotifyUpdate.cxx +++ b/src/db/update/InotifyUpdate.cxx @@ -24,7 +24,7 @@ #include "InotifyDomain.hxx" #include "storage/StorageInterface.hxx" #include "fs/AllocatedPath.hxx" -#include "fs/FileSystem.hxx" +#include "fs/FileInfo.hxx" #include "util/Error.hxx" #include "Log.hxx" @@ -179,7 +179,6 @@ recursive_watch_subdirectories(WatchDirectory *directory, } while ((ent = readdir(dir))) { - struct stat st; int ret; if (skip_path(ent->d_name)) @@ -187,15 +186,15 @@ recursive_watch_subdirectories(WatchDirectory *directory, const auto child_path_fs = AllocatedPath::Build(path_fs, ent->d_name); - ret = StatFile(child_path_fs, st); - if (ret < 0) { - FormatErrno(inotify_domain, - "Failed to stat %s", - child_path_fs.c_str()); + + FileInfo fi; + if (!GetFileInfo(child_path_fs, fi, error)) { + LogError(error); + error.Clear(); continue; } - if (!S_ISDIR(st.st_mode)) + if (!fi.IsDirectory()) continue; ret = inotify_source->Add(child_path_fs.c_str(), IN_MASK, -- cgit v1.2.3