aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2022-03-25 09:46:06 -0600
committerJason A. Donenfeld <Jason@zx2c4.com>2022-03-26 00:10:09 -0600
commitd719f8b600db14c391357a848199c3279507881a (patch)
tree48b825b06b73c597402badcb72fdc77a5c20b73e
parentSend informational messages on stdout (diff)
downloadseedrng-d719f8b600db14c391357a848199c3279507881a.tar.xz
seedrng-d719f8b600db14c391357a848199c3279507881a.zip
Compile with -pedantic
I usually code with GNUisms, but given that the purpose of this project is to make it easy for people to copy and paste this code, I'll stick with a more standard C. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--Makefile2
-rw-r--r--seedrng.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index ef3e0e2..81b6859 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,7 @@ LOCALSTATEDIR ?= /var/lib
RUNSTATEDIR ?= /var/run
CFLAGS ?= -O2 -pipe
-CFLAGS += -std=gnu99 -Wall -Wextra
+CFLAGS += -Wall -Wextra -pedantic
CFLAGS += -DLOCALSTATEDIR="\"$(LOCALSTATEDIR)\"" -DRUNSTATEDIR="\"$(RUNSTATEDIR)\""
seedrng: seedrng.c
diff --git a/seedrng.c b/seedrng.c
index a354e2d..982d8b5 100644
--- a/seedrng.c
+++ b/seedrng.c
@@ -272,7 +272,7 @@ static int read_new_seed(uint8_t *seed, size_t len, bool *is_creditable)
if (ret == (ssize_t)len)
ret = 0;
else
- ret = -errno ?: -EIO;
+ ret = -errno ? -errno : -EIO;
close(urandom_fd);
return ret;
}
@@ -298,7 +298,7 @@ static int seed_rng(uint8_t *seed, size_t len, bool credit)
return -errno;
ret = ioctl(random_fd, RNDADDENTROPY, &req);
if (ret)
- ret = -errno ?: -EIO;
+ ret = -errno ? -errno : -EIO;
close(random_fd);
return ret;
}