diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2024-05-03 20:43:37 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2024-05-03 20:43:37 +0000 |
commit | 6d0c114f57bcd554383a41c9ca791e25e95b81b5 (patch) | |
tree | 7ed5e04fa40a18c9e7d1858ae073b9ef602faa3b /src/libs6/ftrigw_clean.c | |
parent | 35709f34aaafad99c89d9848b68e3d211b7e0f02 (diff) | |
download | s6-6d0c114f57bcd554383a41c9ca791e25e95b81b5.tar.xz |
Restore cleanups in s6-ftrigrd; fix an old bug and a new bug
ftrigw_clean() didn't clean properly.
ftrig1_make() didn't give enough perms to the fifo, notification
could fail in certain cases.
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libs6/ftrigw_clean.c')
-rw-r--r-- | src/libs6/ftrigw_clean.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c index 3ad9e3a..e540aba 100644 --- a/src/libs6/ftrigw_clean.c +++ b/src/libs6/ftrigw_clean.c @@ -15,9 +15,9 @@ int ftrigw_clean (char const *path) DIR *dir = opendir(path) ; if (!dir) return 0 ; { - char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ; + char tmp[pathlen + FTRIG1_PREFIXLEN + 35] ; memcpy(tmp, path, pathlen) ; - tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ; + tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 34] = 0 ; for (;;) { direntry *d ; @@ -26,8 +26,8 @@ int ftrigw_clean (char const *path) d = readdir(dir) ; if (!d) break ; if (strncmp(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ; - if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ; - memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 43) ; + if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 33) continue ; + memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 33) ; fd = open_write(tmp) ; if (fd >= 0) fd_close(fd) ; else if ((errno == ENXIO) && (unlink(tmp) < 0)) e = errno ; |