aboutsummaryrefslogtreecommitdiffstats
path: root/src/krandom.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-03-21 00:11:25 +0100
committerMattias Andrée <maandree@operamail.com>2015-03-21 00:11:25 +0100
commit5c5506e41624e15c6e91a9cd3629706fe7a9ad86 (patch)
treef044511ac76a383b836e1c73c396162beb2f410a /src/krandom.c
parentkrandom as an entropy-generator? (diff)
downloadkrandom-1.1.tar.gz
krandom-1.1.tar.bz2
krandom-1.1.tar.xz
fix for #11.1
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r--src/krandom.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/krandom.c b/src/krandom.c
index 1b5e284..54eca43 100644
--- a/src/krandom.c
+++ b/src/krandom.c
@@ -128,11 +128,13 @@ int main(int argc, char** argv)
ssize_t got;
int r, fd = -1, verbose = 0;
- execname = *argv;
+ execname = argc ? *argv : "krandom";
memset(&state, 0, sizeof(libkeccak_state_t));
libkeccak_generalised_spec_initialise(&gspec);
+ if (!argc)
+ goto skip_argv_parsing;
args_init("Keccak-based userspace pseudorandom number generator",
"krandom [options...]", NULL,
@@ -156,6 +158,7 @@ int main(int argc, char** argv)
if (args_opts_used("-W")) gspec.word_size = atol(LAST("-W"));
if (args_opts_used("-v")) verbose = 1;
+ skip_argv_parsing:
if ((r = make_spec(&gspec, &spec)))
goto done;
@@ -202,7 +205,8 @@ int main(int argc, char** argv)
done:
if (fd >= 0)
close(fd);
- args_dispose();
+ if (argc)
+ args_dispose();
free(generated_random);
libkeccak_state_fast_destroy(&state);
return r;