diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/db/update/InotifyQueue.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/db/update/InotifyQueue.cxx b/src/db/update/InotifyQueue.cxx index 392ac4110..3ed7d3d13 100644 --- a/src/db/update/InotifyQueue.cxx +++ b/src/db/update/InotifyQueue.cxx @@ -24,8 +24,6 @@ #include "Log.hxx" #include "util/StringCompare.hxx" -#include <string.h> - /** * Wait this long after the last change before calling * update_enqueue(). This increases the probability that updates can @@ -55,14 +53,16 @@ InotifyQueue::OnTimeout() } } +gcc_pure static bool path_in(const char *path, const char *possible_parent) { - size_t length = strlen(possible_parent); + if (StringIsEmpty(path)) + return true; - return StringIsEmpty(path) || - (memcmp(possible_parent, path, length) == 0 && - (path[length] == 0 || path[length] == '/')); + auto rest = StringAfterPrefix(path, possible_parent); + return rest != nullptr && + (StringIsEmpty(rest) || rest[0] == '/'); } void |