summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lottery.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-26 09:32:11 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 10:13:56 +0000
commit821026fcf7025074a193f46e5dbba84b8e921e93 (patch)
treeb65eb1696d00a261ede761dff3067ab6047d5544 /util/libreboot-utils/lottery.c
parent8e8f7bced44c5f61e390e81d8a84a93099358453 (diff)
libreboot-utils: improved randomness test
and the module bias handling is fully correct Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lottery.c')
-rw-r--r--util/libreboot-utils/lottery.c17
1 files changed, 4 insertions, 13 deletions
diff --git a/util/libreboot-utils/lottery.c b/util/libreboot-utils/lottery.c
index 8157d7a9..4c3b0f70 100644
--- a/util/libreboot-utils/lottery.c
+++ b/util/libreboot-utils/lottery.c
@@ -7,15 +7,12 @@
#endif
#include <stdio.h>
-#include <stdlib.h>
#include "include/common.h"
int
main(int argc, char *argv[])
{
- char *s1 = NULL;
- int rval = 0;
-
+ int lucky;
#if defined(__OpenBSD__) && defined(OpenBSD)
#if (OpenBSD) >= 509
if (pledge("stdio", NULL) == -1)
@@ -24,16 +21,10 @@ main(int argc, char *argv[])
#endif
setvbuf(stdout, NULL, _IONBF, 0);
- if (win_lottery(&s1))
- rval = 1;
-
- if (s1 != NULL) {
- printf("%s\n\n", s1);
- free(s1);
- }
+ lucky = win_lottery();
- printf("%s\n", rval ? "You won!" : "You lose! Sorry!");
- return rval? EXIT_SUCCESS : EXIT_FAILURE;
+ printf("%s\n", lucky ? "You won!" : "You lose! Sorry!");
+ return lucky ? EXIT_SUCCESS : EXIT_FAILURE;
}/*
( >:3 )