From 4740e274edc80893e3d43dab9adcd1f458b135c9 Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 18 Aug 2014 16:29:18 +0200 Subject: [PATCH] Add more detail in error message from Monitor::run() --- src/monitor.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/monitor.cpp b/src/monitor.cpp index cc920d3..1e00c42 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -29,19 +29,18 @@ bool Monitor::event_accepted(struct inotify_event &event) int Monitor::run() { - int wd, fd; - DEBUG("Starting inotify thread for path %s...\n", path.c_str()); - fd = inotify_init1(IN_CLOEXEC); + int fd = inotify_init1(IN_CLOEXEC); if (fd < 0) { ERROR("Unable to start inotify\n"); return fd; } - wd = inotify_add_watch(fd, path.c_str(), mask); + int wd = inotify_add_watch(fd, path.c_str(), mask); if (wd < 0) { - ERROR("Unable to add inotify watch\n"); + ERROR("Unable to add inotify watch on '%s': %s\n", + path.c_str(), strerror(errno)); close(fd); return wd; }