From c2b036313f8b7c691fef2604e31b0648717715df Mon Sep 17 00:00:00 2001 From: Sebastian Reuße Date: Thu, 14 Dec 2017 16:03:20 +0100 Subject: fq: pass full path to lock file to inotify_add_watch When NQDIR is set, we cannot expect the lock files to be found under the working directory. Fixes #22 Closes: #23 [via git-merge-pr] --- fq.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fq.c b/fq.c index 2adb231..11e176c 100644 --- a/fq.c +++ b/fq.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -154,7 +155,13 @@ main(int argc, char *argv[]) didsth = 1; #ifdef USE_INOTIFY - wd = inotify_add_watch(ifd, argv[i], IN_MODIFY | IN_CLOSE_WRITE); + char fullpath[PATH_MAX]; + snprintf(fullpath, sizeof fullpath, "%s/%s", path, argv[i]); + wd = inotify_add_watch(ifd, fullpath, IN_MODIFY | IN_CLOSE_WRITE); + if (wd == -1) { + perror("inotify_add_watch"); + exit(111); + } #endif while (1) { -- cgit 1.4.1