]> granicus.if.org Git - file/commitdiff
handle time_t properly.
authorChristos Zoulas <christos@zoulas.com>
Sun, 13 Apr 1997 18:28:30 +0000 (18:28 +0000)
committerChristos Zoulas <christos@zoulas.com>
Sun, 13 Apr 1997 18:28:30 +0000 (18:28 +0000)
src/print.c
src/softmagic.c

index 15042ff3f424ec445d6e52dbce3125c9d78351f6..dd7ee83bdb16f9047c6e99e749e17319b10b8e3b 100644 (file)
@@ -40,7 +40,7 @@
 
 #ifndef lint
 static char *moduleid =
-       "@(#)$Id: print.c,v 1.23 1997/01/15 19:28:35 christos Exp $";
+       "@(#)$Id: print.c,v 1.24 1997/04/13 18:28:30 christos Exp $";
 #endif  /* lint */
 
 #define SZOF(a)        (sizeof(a) / sizeof(a[0]))
@@ -91,7 +91,9 @@ struct magic *m;
            case LEDATE:
            case BEDATE:
                    {
-                           char *rt, *pp = ctime((time_t*) &m->value.l);
+                           time_t t = m->value.l;
+                           char *rt, *pp = ctime(&t);
+
                            if ((rt = strchr(pp, '\n')) != NULL)
                                    *rt = '\0';
                            (void) fprintf(stderr, "%s,", pp);
index ab621d2afe492599d3a8dc77d618b47e84726683..94a99176ff65b670794b6e5e93b03904ef2ed869 100644 (file)
@@ -35,7 +35,7 @@
 
 #ifndef        lint
 static char *moduleid = 
-       "@(#)$Id: softmagic.c,v 1.34 1997/01/15 19:28:35 christos Exp $";
+       "@(#)$Id: softmagic.c,v 1.35 1997/04/13 18:28:30 christos Exp $";
 #endif /* lint */
 
 static int match       __P((unsigned char *, int));
@@ -196,6 +196,7 @@ struct magic *m;
 {
        char *pp, *rt;
        uint32 v;
+       time_t time;
        int32 t=0 ;
 
 
@@ -244,7 +245,8 @@ struct magic *m;
        case DATE:
        case BEDATE:
        case LEDATE:
-               pp = ctime((time_t*) &p->l);
+               time = p->l;
+               pp = ctime(&time);
                if ((rt = strchr(pp, '\n')) != NULL)
                        *rt = '\0';
                (void) printf(m->desc, pp);