[hackers] [sbase] Do not rely on the underlying type of time_t in date(1) and touch(1) || sin

From: <git_AT_suckless.org>
Date: Mon, 9 Feb 2015 09:38:16 +0100 (CET)

commit 3988bf4d26faa0b81f13ac9d8cd25ffaec7b90f7
Author: sin <sin_AT_2f30.org>
Date: Sun Feb 8 23:45:03 2015 +0000

    Do not rely on the underlying type of time_t in date(1) and touch(1)
    
    Use LLONG_MAX unconditionally. In practice this only causes trouble
    with systems that are not 2038 ready.

diff --git a/date.c b/date.c
index 467270e..db69091 100644
--- a/date.c
+++ b/date.c
_AT_@ -26,7 +26,7 @@ main(int argc, char *argv[])
         t = time(NULL);
         ARGBEGIN {
         case 'd':
- t = estrtonum(EARGF(usage()), 0, MIN(LLONG_MAX, (time_t)-1));
+ t = estrtonum(EARGF(usage()), 0, LLONG_MAX);
                 break;
         case 'u':
                 tztime = gmtime;
diff --git a/touch.c b/touch.c
index 81c470c..536807a 100644
--- a/touch.c
+++ b/touch.c
_AT_@ -73,7 +73,7 @@ main(int argc, char *argv[])
                 t = st.st_mtime;
                 break;
         case 't':
- t = estrtonum(EARGF(usage()), 0, MIN(LLONG_MAX, (time_t)-1));
+ t = estrtonum(EARGF(usage()), 0, LLONG_MAX);
                 break;
         default:
                 usage();
Received on Mon Feb 09 2015 - 09:38:16 CET

This archive was generated by hypermail 2.3.0 : Mon Feb 09 2015 - 09:48:15 CET