From a6c73232a8ffeed7c58dd45b766e241f8ec59d25 Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Sun, 22 Feb 2015 11:13:57 +0100 Subject: Use LONG_MAX for invalid dates in parse_datearg() We cannot use -1 here since negative values are valid dates. Signed-off-by: Lukas Fleischer --- src/args.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/args.c b/src/args.c index 6686fe0..e600cc2 100644 --- a/src/args.c +++ b/src/args.c @@ -326,7 +326,7 @@ static long parse_datearg(const char *str) (int *)&day.mm, (int *)&day.dd, NULL)) return date2sec(day, 0, 0); - return -1; + return LONG_MAX; } static long parse_datetimearg(const char *str) @@ -345,7 +345,7 @@ static long parse_datetimearg(const char *str) if (!parse_time(time, &hour, &min)) return -1; ret = parse_datearg(date); - if (!ret) + if (ret == LONG_MAX) return -1; ret += hour * HOURINSEC + min * MININSEC; @@ -353,7 +353,7 @@ static long parse_datetimearg(const char *str) } ret = parse_datearg(date); - if (ret < 0) { + if (ret == LONG_MAX) { /* No date specified, use time only. */ if (!parse_time(date, &hour, &min)) return -1; -- cgit v1.2.3