tStore inode path as passed on the command line - wendy - watch files/directories and run commands on any event
 (HTM) git clone git://z3bra.org/wendy
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7fb6bed951223737cf5f0440b1bbdb00368e0e30
 (DIR) parent 15c460099b6b0bfaa575b88646894e4d8b6ab755
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Fri, 28 Feb 2020 19:13:02 +0100
       
       Store inode path as passed on the command line
       
       Diffstat:
         M wendy.c                             |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
 (DIR) diff --git a/wendy.c b/wendy.c
       t@@ -67,8 +67,11 @@ watch(int fd, char *pathname, int mask)
                if (!w)
                        return NULL;
        
       -        /* store full inode path */
       -        realpath(pathname, w->path);
       +        /* store inode path, eventually removing trailing '/' */
       +        len = strlcpy(w->path, pathname, PATH_MAX);
       +        if (w->path[len - 2] == '/')
       +                w->path[len - 2] == '\0';
       +
                w->wd = inotify_add_watch(fd, w->path, mask);
                if (w->wd < 0) {
                        perror(pathname);