diff options
Diffstat (limited to 'src/libs6/ftrigw_clean.c')
-rw-r--r-- | src/libs6/ftrigw_clean.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/libs6/ftrigw_clean.c b/src/libs6/ftrigw_clean.c index 5e344eb..3253f7a 100644 --- a/src/libs6/ftrigw_clean.c +++ b/src/libs6/ftrigw_clean.c @@ -1,23 +1,22 @@ /* ISC license. */ -#include <sys/types.h> +#include <string.h> #include <unistd.h> #include <errno.h> #include <skalibs/direntry.h> -#include <skalibs/bytestr.h> #include <skalibs/djbunix.h> #include "ftrig1.h" #include <s6/ftrigw.h> int ftrigw_clean (char const *path) { - size_t pathlen = str_len(path) ; + size_t pathlen = strlen(path) ; int e = 0 ; DIR *dir = opendir(path) ; if (!dir) return 0 ; { char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ; - byte_copy(tmp, pathlen, path) ; + memcpy(tmp, path, pathlen) ; tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ; for (;;) { @@ -26,9 +25,9 @@ int ftrigw_clean (char const *path) errno = 0 ; d = readdir(dir) ; if (!d) break ; - if (str_diffn(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ; - if (str_len(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ; - byte_copy(tmp + pathlen + 1, FTRIG1_PREFIXLEN + 43, d->d_name) ; + 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) ; fd = open_write(tmp) ; if (fd >= 0) fd_close(fd) ; else if ((errno == ENXIO) && (unlink(tmp) < 0)) e = errno ; |