summaryrefslogtreecommitdiff
path: root/src/clients
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:21:27 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2016-10-14 17:21:27 +0000
commita50b256dde29028a056176a2bef99096f6c5b619 (patch)
tree2380b51100fa82d3f8bbfbe7d6b57447266adb6f /src/clients
parent36fa9ff7abbc5a7ab8979073f401d84cba609322 (diff)
downloads6-dns-a50b256dde29028a056176a2bef99096f6c5b619.tar.xz
Port to the new librandom API.
Diffstat (limited to 'src/clients')
-rw-r--r--src/clients/s6-randomip.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c
index b220374..2c1581a 100644
--- a/src/clients/s6-randomip.c
+++ b/src/clients/s6-randomip.c
@@ -38,19 +38,16 @@ int main (int argc, char const *const *argv)
argc -= subgetopt_here.ind ; argv += subgetopt_here.ind ;
if (!what) what = 1 ;
what = 1 << (1 << what) ;
- if (!badrandom_init()) strerr_diefu1sys(111, "init RNG") ;
+ if (!random_init()) strerr_diefu1sys(111, "init random generator") ;
for (i = 0 ; !finite || (i < n) ; i++)
{
unsigned int len = what ;
if (len > 16)
{
- char c ;
- if (badrandom_string(&c, 1) < 1)
- strerr_diefu1sys(111, "badrandom_string") ;
+ unsigned char c = random_char() ;
len = (c & 1) ? 16 : 4 ;
}
- if (badrandom_string(ip, len) < 4)
- strerr_diefu1sys(111, "badrandom_string") ;
+ random_string(ip, len) ;
len = (len == 16) ? ip6_fmt(fmt, ip) : ip4_fmt(fmt, ip) ;
fmt[len++] = '\n' ;
if (buffer_put(buffer_1, fmt, len) < (int)len)