diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-14 17:16:43 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-14 17:16:43 +0000 |
commit | 4a90dd1f9063fd5a91431ee6873c25c5c8229805 (patch) | |
tree | 8c15b69aaa7f3c56ad60100463c3769f8f7ae4e4 /src | |
parent | b189876a10023325d28bc439b956ff83dbe51845 (diff) | |
download | s6-4a90dd1f9063fd5a91431ee6873c25c5c8229805.tar.xz |
Port to the new librandom API
Diffstat (limited to 'src')
-rw-r--r-- | src/conn-tools/s6-accessrules-cdb-from-fs.c | 4 | ||||
-rw-r--r-- | src/libs6/ftrig1_make.c | 2 | ||||
-rw-r--r-- | src/libs6/s6-ftrigrd.c | 3 |
3 files changed, 7 insertions, 2 deletions
diff --git a/src/conn-tools/s6-accessrules-cdb-from-fs.c b/src/conn-tools/s6-accessrules-cdb-from-fs.c index 20fef4d..c1aa992 100644 --- a/src/conn-tools/s6-accessrules-cdb-from-fs.c +++ b/src/conn-tools/s6-accessrules-cdb-from-fs.c @@ -110,8 +110,10 @@ 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) < 0) + if (!random_sauniquename(&tmp, 8)) strerr_diefu1sys(111, "random_sauniquename") ; if (!stralloc_readyplus(&tmp, 8210)) strerr_diefu1sys(111, "stralloc_catb") ; diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c index 7aedd08..83ffca9 100644 --- a/src/libs6/ftrig1_make.c +++ b/src/libs6/ftrig1_make.c @@ -25,7 +25,7 @@ int ftrig1_make (ftrig1_t *f, char const *path) tmp[pathlen + 2 + FTRIG1_PREFIXLEN] = ':' ; if (!timestamp(tmp + pathlen + 3 + FTRIG1_PREFIXLEN)) return 0 ; tmp[pathlen + 28 + FTRIG1_PREFIXLEN] = ':' ; - if (random_name(tmp + pathlen + 29 + FTRIG1_PREFIXLEN, 16) < 16) return 0 ; + random_name(tmp + pathlen + 29 + FTRIG1_PREFIXLEN, 16) ; tmp[pathlen + 45 + FTRIG1_PREFIXLEN] = 0 ; { diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c index b4c4c86..3200300 100644 --- a/src/libs6/s6-ftrigrd.c +++ b/src/libs6/s6-ftrigrd.c @@ -13,6 +13,7 @@ #include <skalibs/stralloc.h> #include <skalibs/sig.h> #include <skalibs/tai.h> +#include <skalibs/random.h> #include <skalibs/djbunix.h> #include <skalibs/iopause.h> #include <skalibs/unixmessage.h> @@ -194,6 +195,8 @@ int main (void) if (ndelay_on(0) < 0) strerr_diefu2sys(111, "ndelay_on ", "0") ; if (ndelay_on(1) < 0) strerr_diefu2sys(111, "ndelay_on ", "1") ; if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; + if (!random_init()) + strerr_diefu1sys(111, "init random generator") ; { tain_t deadline ; |