Skip to content

Commit

Permalink
Fixed exist status when using --once option. Updated man page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jirka Hladky committed Jan 2, 2022
1 parent 1f6a41a commit 9e4a1f5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions man/haveged.8
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/haveged.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 9e4a1f5

Please sign in to comment.