This is one of few issues discovered with static analyzer.
Viacheslav Kruglov (1):
Fix logical error in comparison with ULONG_MAX
src/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
--
2.45.2
From: Viacheslav Kruglov <me@hograthm.com>
The expression `epoch > ULONG_MAX` will always return false because
`epoch` is of type `unsigned long long`.
---
src/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/main.c b/src/main.c
index 4591098..fa733c3 100644
--- a/src/main.c+++ b/src/main.c
@@ -96,10 +96,10 @@ static void parse_preamble(struct parser *p) {
endptr);
exit(EXIT_FAILURE);
}
- if (epoch > ULONG_MAX) {+ if (epoch > ULLONG_MAX) { fprintf(stderr, "$SOURCE_DATE_EPOCH: value must be smaller than or "
- "equal to %lu but was found to be: %llu \n",- ULONG_MAX, epoch);+ "equal to %llu but was found to be: %llu \n",+ ULLONG_MAX, epoch); exit(EXIT_FAILURE);
}
date_time = epoch;
--
2.45.2