diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/conn-tools/s6-accessrules-cdb-from-fs.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c index ccd1204..9efacdb 100644 --- a/src/conn-tools/s6-accessrules-cdb-from-fs.c +++ b/src/conn-tools/s6-accessrules-cdb-from-fs.c @@ -3,6 +3,7 @@ #include <stdint.h> #include <unistd.h> #include <errno.h> +#include <stdlib.h> #include <stdio.h> #include <skalibs/types.h> #include <skalibs/cdb_make.h> @@ -11,9 +12,9 @@ #include <skalibs/direntry.h> #include <skalibs/djbunix.h> #include <skalibs/skamisc.h> -#include <skalibs/random.h> #define USAGE "s6-accessrules-cdb-from-fs cdbfile dir" +#define SUFFIX ":s6-accessrules-cdb-from-fs:XXXXXX" static stralloc tmp = STRALLOC_ZERO ; @@ -109,16 +110,12 @@ int main (int argc, char const *const *argv) int fd ; PROG = "s6-accessrules-cdb-from-fs" ; if (argc < 3) strerr_dieusage(100, USAGE) ; - if (!random_init()) - strerr_diefu1sys(111, "init random generator") ; if (!stralloc_cats(&tmp, argv[1])) return 0 ; - if (!random_sauniquename(&tmp, 8)) - strerr_diefu1sys(111, "random_sauniquename") ; if (!stralloc_readyplus(&tmp, 8210)) strerr_diefu1sys(111, "stralloc_catb") ; - stralloc_0(&tmp) ; - fd = open_trunc(tmp.s) ; - if (fd < 0) strerr_diefu2sys(111, "open_trunc ", tmp.s) ; + stralloc_catb(&tmp, SUFFIX, sizeof(SUFFIX)) ; + fd = mkstemp(tmp.s) ; + if (fd < 0) strerr_diefu2sys(111, "mkstemp ", tmp.s) ; if (cdb_make_start(&c, fd) < 0) { cleanup() ; |