]> git.ipfire.org Git - thirdparty/chrony.git/commit
leapdb: fix ordered comparison against NULL pointer
authorAhmad Fatoum <a.fatoum@pengutronix.de>
Fri, 27 Jun 2025 11:58:35 +0000 (13:58 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Wed, 2 Jul 2025 12:49:21 +0000 (14:49 +0200)
commitc5d3be8cc44618441b82cf94540333461eeb3e50
tree9b64c8bbf4729f72b922422c3d1483bf542f9fcb
parent3e32e7e69412042f2477c02319e36eab6aee133d
leapdb: fix ordered comparison against NULL pointer

fgets returns either a valid pointer with the same value as its first
argument or NULL on error or EOF.

GCC 12.2.0 -Wextra warns against relational comparison of the return
value:

  leapdb.c:127:38: warning: ordered comparison of pointer with integer zero [-Wextra]

For clarity, and because the C standard doesn't mandate that valid pointers
have to compare greater than the null pointer constant, replace the
relational expression with an equality expression
leapdb.c