summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lottery.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-26 02:14:09 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-26 02:25:21 +0000
commitf9e206c959cce498c8416a79d6c5db9a04067af6 (patch)
tree304fc465fa4b9ebf3f2abb591b7b4dfa2bbe7465 /util/libreboot-utils/lottery.c
parent4e942b0832a8dc2ea882f4aa1a4778976572f6b8 (diff)
more cleanup on rand.cHEADmaster
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lottery.c')
-rw-r--r--util/libreboot-utils/lottery.c30
1 files changed, 7 insertions, 23 deletions
diff --git a/util/libreboot-utils/lottery.c b/util/libreboot-utils/lottery.c
index 711a2449..8157d7a9 100644
--- a/util/libreboot-utils/lottery.c
+++ b/util/libreboot-utils/lottery.c
@@ -13,8 +13,8 @@
int
main(int argc, char *argv[])
{
- size_t s;
- char *s1;
+ char *s1 = NULL;
+ int rval = 0;
#if defined(__OpenBSD__) && defined(OpenBSD)
#if (OpenBSD) >= 509
@@ -22,36 +22,20 @@ main(int argc, char *argv[])
err_no_cleanup(0, errno, "openbsd won it");
#endif
#endif
-
setvbuf(stdout, NULL, _IONBF, 0);
- if (win_lottery()) {
- printf("You won!");
- return 0;
- }
-
- s1 = rmalloc(&s);
+ if (win_lottery(&s1))
+ rval = 1;
if (s1 != NULL) {
- printf("%s\n\nYou lose. Sorry!\n", s1);
+ printf("%s\n\n", s1);
free(s1);
}
- return 1;
+ printf("%s\n", rval ? "You won!" : "You lose! Sorry!");
+ return rval? EXIT_SUCCESS : EXIT_FAILURE;
}/*
( >:3 )
/| |\
/ \ */
-
-
-
-
-
-
-
-
-
-
-
-