aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonas Gunz <himself@jonasgunz.de> 2022-12-08 16:50:01 +0100
committerGravatar Jonas Gunz <himself@jonasgunz.de> 2022-12-08 16:50:01 +0100
commite2fda2e2ca32a5200d9c765111585e4942b0cc81 (patch)
treee238c5bf0958613989efd325865fcea3100c2ce0
parent8d288cf0833621aa9097bc08e49b6833616b64a1 (diff)
downloadmonitoring-plugins-e2fda2e2ca32a5200d9c765111585e4942b0cc81.tar.gz
check_by_ssh: Change -r to use random()
Changed the -r random wait option to use random() intead of /dev/urandom
-rw-r--r--plugins/check_by_ssh.c8
1 files changed, 2 insertions, 6 deletions
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 */