diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 11:59:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2017-03-12 11:59:43 +0000 |
commit | c60ebd422171808ad58b936914055397bb205bef (patch) | |
tree | 7db3e5728d72ad209f8e22b9eb9f337e0b0c3e58 /src/libs6/ftrigw_clean.c | |
parent | e28fe5908a91d8795ca9923d64eeed7d3e898434 (diff) | |
download | s6-c60ebd422171808ad58b936914055397bb205bef.tar.xz |
Adapt to skalibs-2.5.0.0
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 ; |