From e2fda2e2ca32a5200d9c765111585e4942b0cc81 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Thu, 8 Dec 2022 16:50:01 +0100 Subject: check_by_ssh: Change -r to use random() Changed the -r random wait option to use random() intead of /dev/urandom --- plugins/check_by_ssh.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 405f1c2b..627b876b 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -94,12 +94,8 @@ main (int argc, char **argv) /* Wait a random amount of time */ if (random_wait_max) { - uint8_t random = 0; - int fd = open("/dev/urandom", O_RDONLY); - read(fd, &random, sizeof(uint8_t)); - close(fd); - - sleep( (random_wait_max * random) / 255 ); + srand(time(NULL)); + sleep(random() % random_wait_max); } /* Set signal handling and alarm timeout */ -- cgit v1.2.3