NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

bin/48095: pax(1): casts from time_t to long



>Number:         48095
>Category:       bin
>Synopsis:       pax(1): casts from time_t to long
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 29 13:00:00 +0000 2013
>Originator:     NAKAJIMA Yoshihiro
>Release:        NetBSD-current/20130726
>Organization:
>Environment:
System: NetBSD vajra 6.99.23 NetBSD 6.99.23 (VAJRA) #3: Sun Jul 28 16:42:13 JST 
2013 nakayosh@vajra:/usr/src/sys/arch/i386/compile/VAJRA i386
Architecture: i386
Machine: i386
>Description:

There are two casts from time_t to long in pax(1).
timeval in 4.4BSD is defined as:

struct timeval {
        long    tv_sec;
        long    tv_usec;
};

I think they are the remains.

>How-To-Repeat:
>Fix:

diff -u src/bin/pax/file_subs.c.ORIG src/bin/pax/file_subs.c
--- src/bin/pax/file_subs.c.ORIG        2009-04-08 04:52:35.000000000 +0900
+++ src/bin/pax/file_subs.c     2013-07-29 21:47:05.000000000 +0900
@@ -791,9 +791,9 @@
        struct timeval tv[2];
        struct stat sb;
 
-       tv[0].tv_sec = (long)atime;
+       tv[0].tv_sec = atime;
        tv[0].tv_usec = 0;
-       tv[1].tv_sec = (long)mtime;
+       tv[1].tv_sec = mtime;
        tv[1].tv_usec = 0;
        if (!frc && (!patime || !pmtime)) {
                /*



Home | Main Index | Thread Index | Old Index