From 9e4a1f53cfbb2a7aa1f534861e6f03587e5d6f16 Mon Sep 17 00:00:00 2001 From: Jirka Hladky Date: Sun, 2 Jan 2022 01:14:27 +0100 Subject: Fixed exist status when using --once option. Updated man page --- man/haveged.8 | 3 +++ src/haveged.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/man/haveged.8 b/man/haveged.8 index f88dc76..b1dc7cc 100644 --- a/man/haveged.8 +++ b/man/haveged.8 @@ -63,6 +63,9 @@ use "-" for stdout. -F , --Foreground Run daemon in foreground. Do not fork and detach. .TP +-e , --once +Provide entropy to the kernel once and quit immediatelly. +.TP -i nnn, --inst=nnn Set instruction cache size to nnn KB. Default is 16 or as determined dynamically. .TP diff --git a/src/haveged.c b/src/haveged.c index fcfe764..293f5e6 100644 --- a/src/haveged.c +++ b/src/haveged.c @@ -657,8 +657,10 @@ static void run_daemon( /* RETURN: nothing */ if (ioctl(random_fd, RNDADDENTROPY, output) == -1) error_exit("RNDADDENTROPY failed!"); h->n_entropy_bytes += nbytes; - if (params->once == 1) + if (params->once == 1) { + params->exit_code = 0; error_exit("Entropy refilled once (%d bytes), exiting.", nbytes); + } t[0] = t[1]; continue; } -- cgit v1.2.3