aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann E. MORIN <yann.morin.1998@free.fr>2022-03-24 09:49:44 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2022-03-26 00:10:09 -0600
commitda63c26e6c8bce8ba908e10ac93c1dc7a984d93c (patch)
tree1f046d9138c5d351408d6022c2638acf9d642bda
parentInitial commit (diff)
downloadseedrng-da63c26e6c8bce8ba908e10ac93c1dc7a984d93c.tar.xz
seedrng-da63c26e6c8bce8ba908e10ac93c1dc7a984d93c.zip
Send informational messages on stdout
Currently, the messages about saving the seed or seeding the RNG are sent to stderr, but they are informational messages we want to see when the program works as expected; only error messages should be directed to stderr. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--seedrng.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/seedrng.c b/seedrng.c
index ff13b51..a354e2d 100644
--- a/seedrng.c
+++ b/seedrng.c
@@ -347,7 +347,7 @@ static int seed_from_file_if_exists(const char *filename, bool credit, struct bl
blake2s_update(hash, &seed_len, sizeof(seed_len));
blake2s_update(hash, seed, seed_len);
- fprintf(stderr, "Seeding %zd bits %s crediting\n", seed_len * 8, credit ? "and" : "without");
+ fprintf(stdout, "Seeding %zd bits %s crediting\n", seed_len * 8, credit ? "and" : "without");
ret = seed_rng(seed, seed_len, credit);
if (ret < 0)
fprintf(stderr, "ERROR: Unable to seed: %s\n", strerror(-ret));
@@ -408,7 +408,7 @@ int main(int argc __attribute__((unused)), char *argv[] __attribute__((unused)))
blake2s_update(&hash, new_seed, new_seed_len);
blake2s_final(&hash, new_seed + new_seed_len - BLAKE2S_HASH_LEN);
- fprintf(stderr, "Saving %zu bits of %s seed for next boot\n", new_seed_len * 8, new_seed_creditable ? "creditable" : "non-creditable");
+ fprintf(stdout, "Saving %zu bits of %s seed for next boot\n", new_seed_len * 8, new_seed_creditable ? "creditable" : "non-creditable");
fd = open(NON_CREDITABLE_SEED, O_WRONLY | O_CREAT | O_TRUNC, 0400);
if (fd < 0) {
fprintf(stderr, "ERROR: Unable to open seed file for writing: %s\n", strerror(errno));