NetBSD-Bugs archive

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

bin/38738: /bin/mv mv.c differences from openbsd



>Number:         38738
>Category:       bin
>Synopsis:       /bin/mv mv.c differences from openbsd
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat May 24 23:10:00 +0000 2008
>Originator:     murray armfield
>Release:        NetBSD-current
>Organization:
N/A
>Environment:
NetBSD zeus.river-styx.org 4.99.63 NetBSD 4.99.63 (ZEUS) #1: Tue May 20 
16:19:02 EST 2008  
admin%zeus.river-styx.org@localhost:/vol01/build/obj/sys/arch/amd64/compile/ZEUS
 amd64
>Description:
Upon inspection of /bin/mv/mv.c from OpenBSD versus the NetBSD version, there 
are a couple of differences. One static varaiable not reset on error path and a 
simple type correction.
>How-To-Repeat:
Inspect OpenBSD /bin/mv/mv.c versus NetBSD /bin/mv/mv.c
>Fix:
Index: mv.c
===================================================================
RCS file: /cvsroot/src/bin/mv/mv.c,v
retrieving revision 1.39
diff -u -u -p -r1.39 mv.c
--- mv.c        16 Jan 2008 11:43:34 -0000      1.39
+++ mv.c        22 May 2008 03:32:01 -0000
@@ -256,7 +256,7 @@ int
 fastcopy(char *from, char *to, struct stat *sbp)
 {
        struct timeval tval[2];
-       static u_int blen;
+       static blksize_t blen;
        static char *bp;
        int nread, from_fd, to_fd;

@@ -272,6 +272,7 @@ fastcopy(char *from, char *to, struct st
        }
        if (!blen && !(bp = malloc(blen = sbp->st_blksize))) {
                warn(NULL);
+               blen = 0;
                (void)close(from_fd);
                (void)close(to_fd);
                return (1);



Home | Main Index | Thread Index | Old Index