[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: Tue, 24 Mar 2015 23:53:38 +0100 (CET)

commit 8f5d77d8c7c92c0cb7936c234c4decee579c60a6
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 Tue Mar 24 2015 - 23:53:38 CET

This archive was generated by hypermail 2.3.0 : Wed Mar 25 2015 - 00:08:25 CET