diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-14 17:18:51 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2016-10-14 17:18:51 +0000 |
commit | 39e9677791c00ac8dab9b8cabbf13ba639679e34 (patch) | |
tree | d297b58906b9cc24cf4e4ad3f1cc958eece708a2 /src/skaembutils/s6-uniquename.c | |
parent | 44e07b7ac6b060d889fb6d097956c0ca4150662c (diff) | |
download | s6-portable-utils-39e9677791c00ac8dab9b8cabbf13ba639679e34.tar.gz s6-portable-utils-39e9677791c00ac8dab9b8cabbf13ba639679e34.tar.xz s6-portable-utils-39e9677791c00ac8dab9b8cabbf13ba639679e34.zip |
Port to new librandom API
Diffstat (limited to 'src/skaembutils/s6-uniquename.c')
-rw-r--r-- | src/skaembutils/s6-uniquename.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/skaembutils/s6-uniquename.c b/src/skaembutils/s6-uniquename.c index 06418e5..2ac3adb 100644 --- a/src/skaembutils/s6-uniquename.c +++ b/src/skaembutils/s6-uniquename.c @@ -31,8 +31,10 @@ int main (int argc, char const *const *argv) argc -= l.ind ; argv += l.ind ; } if (argc < 1) usage() ; + if (!random_init()) + strerr_diefu1sys(111, "init random generator") ; if (!stralloc_cats(&sa, argv[0])) strerr_diefu1sys(111, "stralloc_cats") ; - if ((n ? random_sauniquename(&sa, n) : sauniquename(&sa)) < 0) + if (!(n ? random_sauniquename(&sa, n) : sauniquename(&sa))) strerr_diefu1sys(111, "make unique name") ; if (!stralloc_catb(&sa, "\n", 1)) strerr_diefu1sys(111, "stralloc_cats") ; if (allwrite(1, sa.s, sa.len) < sa.len) strerr_diefu1sys(111, "write to stdout") ; |