summaryrefslogtreecommitdiff
path: root/src/random.c
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2024-04-06 11:42:57 -0300
committerEuAndreh <eu@euandre.org>2024-04-06 11:42:57 -0300
commitc05302791c128c7e29cd4beabfbcd8ce8036390a (patch)
tree22f85849cd2ed8c135182a85dffa45be69c03bec /src/random.c
parentStart "rc = -1" instead of 0 (diff)
downloadpindaiba-c05302791c128c7e29cd4beabfbcd8ce8036390a.tar.gz
pindaiba-c05302791c128c7e29cd4beabfbcd8ce8036390a.tar.xz
src/: Check "if (x != NULL)" instead of "if (x)"
Diffstat (limited to 'src/random.c')
-rw-r--r--src/random.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/random.c b/src/random.c
index 7574074..fa87cbb 100644
--- a/src/random.c
+++ b/src/random.c
@@ -18,7 +18,7 @@ urandom_bytes(const size_t n, uint8_t (*const addr)[]) {
FILE *f = NULL;
f = fopen("/dev/urandom", "r");
- if (!f) {
+ if (f == NULL) {
logerr("fopen(\"/dev/urandom\", \"r\"): %s\n", strerror(errno));
goto out;
}
@@ -32,7 +32,7 @@ urandom_bytes(const size_t n, uint8_t (*const addr)[]) {
rc = 0;
out:
- if (f) {
+ if (f != NULL) {
if (fclose(f)) {
logerr("fclose(f): %s\n", strerror(errno));
rc = -1;