diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2022-04-09 15:48:31 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2022-04-09 15:48:31 +0000 |
commit | edb658eb85f0546ee72655f1b5cbacda7853db41 (patch) | |
tree | 671d1aa550cd1dac5433ba4b275b3fe1868fb2f3 /src/clients/s6-randomip.c | |
parent | 199a1f4b807b7dd3e12b0dd6c1c0a86e6ed2b4b3 (diff) | |
download | s6-dns-edb658eb85f0546ee72655f1b5cbacda7853db41.tar.xz |
Prepare for 2.3.5.4; adapt to skalibs-2.12.0.0
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/clients/s6-randomip.c')
-rw-r--r-- | src/clients/s6-randomip.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/clients/s6-randomip.c b/src/clients/s6-randomip.c index 9419454..3ab98bb 100644 --- a/src/clients/s6-randomip.c +++ b/src/clients/s6-randomip.c @@ -2,6 +2,7 @@ #include <sys/types.h> #include <errno.h> + #include <skalibs/types.h> #include <skalibs/sgetopt.h> #include <skalibs/strerr2.h> @@ -39,16 +40,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 (!random_init()) strerr_diefu1sys(111, "init random generator") ; for (i = 0 ; !finite || (i < n) ; i++) { size_t len = what ; if (len > 16) { - unsigned char c = random_char() ; + char c ; + random_buf(&c, 1) ; len = (c & 1) ? 16 : 4 ; } - random_string(ip, len) ; + random_buf(ip, len) ; len = (len == 16) ? ip6_fmt(fmt, ip) : ip4_fmt(fmt, ip) ; fmt[len++] = '\n' ; if (buffer_put(buffer_1, fmt, len) < (ssize_t)len) |