From c05302791c128c7e29cd4beabfbcd8ce8036390a Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Sat, 6 Apr 2024 11:42:57 -0300 Subject: src/: Check "if (x != NULL)" instead of "if (x)" --- src/random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/random.c') 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; -- cgit v1.2.3