summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrnhmjoj <rnhmjoj@inventati.org>2020-02-07 17:46:54 +0100
committerrnhmjoj <rnhmjoj@inventati.org>2020-02-07 17:46:54 +0100
commit51e8117654fb092ae5412d7aa184bfc6b498c954 (patch)
tree04661aa1f9d90a2d5cca6c6d27239d6c70e678e7
parent1d757ff6fa30079790fc44b141f6d0e4d5411f13 (diff)
Fix incorrect error handling in macTime()
mktime() and time() return (time_t -1) to signal an error. Checking for negative values will incorrectly assume an error happened for any calendar date before the unix epoch.
-rw-r--r--util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/util.c b/util.c
index bcbfa2f..4482c9a 100644
--- a/util.c
+++ b/util.c
@@ -213,10 +213,10 @@ macTime(int *hi, unsigned *lo)
tm.tm_isdst = -1;
macEpoch = mktime_gmt(&tm);
- if(macEpoch < 0) return -1;
+ if(macEpoch == -1) return -1;
current = time(NULL);
- if(current < 0)
+ if(current == -1)
return -1;
if(current < macEpoch) {