groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] [libgroff]: Remove redundant checks.


From: Alejandro Colomar
Subject: [PATCH 1/4] [libgroff]: Remove redundant checks.
Date: Mon, 15 Jan 2024 00:50:55 +0100

ERANGE can only happen if strtol(3) returns either LONG_MIN or LONG_MAX.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
---
 src/libs/libgroff/curtime.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/libs/libgroff/curtime.cpp b/src/libs/libgroff/curtime.cpp
index 277755cab..490fc3018 100644
--- a/src/libs/libgroff/curtime.cpp
+++ b/src/libs/libgroff/curtime.cpp
@@ -42,8 +42,7 @@ struct tm *current_time()
     char *endptr;
     long epoch = strtol(source_date_epoch, &endptr, 10);
 
-    if ((errno == ERANGE && (epoch == LONG_MAX || epoch == LONG_MIN)) ||
-       (errno != 0 && epoch == 0))
+    if ((errno == ERANGE) || (errno != 0 && epoch == 0))
       fatal("$SOURCE_DATE_EPOCH: strtol: %1", strerror(errno));
     if (endptr == source_date_epoch)
       fatal("$SOURCE_DATE_EPOCH: no digits found: '%1'", endptr);
-- 
2.43.0

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]