diff options
author | Sebastian Reuße <seb@wirrsal.net> | 2017-12-14 16:03:20 +0100 |
---|---|---|
committer | Leah Neukirchen <leah@vuxu.org> | 2017-12-14 17:15:18 +0100 |
commit | c2b036313f8b7c691fef2604e31b0648717715df (patch) | |
tree | dba0234d76e22dc4aa9d12fcb9e237b20ee010bf | |
parent | 74de9b11061b353e58e9a8698ecb956497b7a742 (diff) | |
download | nq-c2b036313f8b7c691fef2604e31b0648717715df.tar.gz nq-c2b036313f8b7c691fef2604e31b0648717715df.tar.xz nq-c2b036313f8b7c691fef2604e31b0648717715df.zip |
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]
-rw-r--r-- | fq.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fq.c b/fq.c index 2adb231..11e176c 100644 --- a/fq.c +++ b/fq.c @@ -13,6 +13,7 @@ #include <dirent.h> #include <errno.h> #include <fcntl.h> +#include <limits.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -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) { |