mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 20:35:06 -05:00
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
This commit is contained in:
committed by
Miroslav Lichvar
parent
3e32e7e694
commit
c5d3be8cc4
2
leapdb.c
2
leapdb.c
@@ -124,7 +124,7 @@ get_list_leap(time_t when, int *tai_offset)
|
|||||||
/* leap-seconds.list timestamps are relative to 1 Jan 1900, 00:00:00 */
|
/* leap-seconds.list timestamps are relative to 1 Jan 1900, 00:00:00 */
|
||||||
when1900 = (int64_t)when + LEAP_SEC_LIST_OFFSET;
|
when1900 = (int64_t)when + LEAP_SEC_LIST_OFFSET;
|
||||||
|
|
||||||
while (fgets(line, sizeof line, f) > 0) {
|
while (fgets(line, sizeof line, f)) {
|
||||||
int64_t lsl_when;
|
int64_t lsl_when;
|
||||||
int lsl_tai_offset;
|
int lsl_tai_offset;
|
||||||
char *p;
|
char *p;
|
||||||
|
|||||||
Reference in New Issue
Block a user