tFix off-by-one error to remove trailing "/" - 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 2c69802f83c5a98433d4253c3fa9bf8eadfb6daa
(DIR) parent 5d2f4dcb32981d7ff60a82b5b192ad53b2c7cc40
(HTM) Author: Willy Goiffon <dev@z3bra.org>
Date: Tue, 2 Jun 2020 10:44:32 +0200
Fix off-by-one error to remove trailing "/"
Diffstat:
M wendy.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
(DIR) diff --git a/wendy.c b/wendy.c
t@@ -88,8 +88,8 @@ watch(int fd, char *pathname, int mask)
/* store inode path, eventually removing trailing '/' */
len = strlcpy(w->path, pathname, PATH_MAX);
- if (w->path[len - 2] == '/')
- w->path[len - 2] == '\0';
+ if (w->path[len - 1] == '/')
+ w->path[len - 1] == '\0';
w->wd = inotify_add_watch(fd, w->path, mask);
if (w->wd < 0) {