diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-30 13:08:04 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2020-11-30 13:08:04 +0000 |
commit | ba3bcbb86ea0177349bcd021559347248d6ab10a (patch) | |
tree | 23d8be4d59a1639ebea301fb2caf39b8b1ed0e27 /src/libs6rc/s6rc_sanitize_dir.c | |
parent | 79cb9644f99f056641f4c145da6e7ca63b333b80 (diff) | |
download | s6-rc-ba3bcbb86ea0177349bcd021559347248d6ab10a.tar.xz |
Stash temporary changes. Does not build; is not intended to.
Diffstat (limited to 'src/libs6rc/s6rc_sanitize_dir.c')
-rw-r--r-- | src/libs6rc/s6rc_sanitize_dir.c | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/src/libs6rc/s6rc_sanitize_dir.c b/src/libs6rc/s6rc_sanitize_dir.c deleted file mode 100644 index 9f647a9..0000000 --- a/src/libs6rc/s6rc_sanitize_dir.c +++ /dev/null @@ -1,26 +0,0 @@ -/* ISC license. */ - -#include <string.h> -#include <skalibs/stralloc.h> -#include <skalibs/djbunix.h> -#include <s6-rc/s6rc-utils.h> - -int s6rc_sanitize_dir (stralloc *sa, char const *fn, size_t *dirlen) -{ - size_t base = sa->len ; - size_t fnlen = strlen(fn) ; - size_t ddirlen ; - int wasnull = !sa->s ; - if (!sadirname(sa, fn, fnlen)) return 0 ; - if (sa->len != base + 1 || sa->s[base] != '/') - if (!stralloc_catb(sa, "/", 1)) goto err ; - ddirlen = sa->len ; - if (!sabasename(sa, fn, fnlen)) goto err ; - *dirlen = ddirlen ; - return 1 ; - - err: - if (wasnull) stralloc_free(sa) ; - else sa->len = base ; - return 0 ; -} |