Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Mar 2000 14:52:53 -0500 (EST)
From:      Jonathan Chen <jon@spock.org>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   bin/17476: uudecode -i (no overwrite) flag bogus
Message-ID:  <200003181952.OAA46459@spock.org>

next in thread | raw e-mail | index | archive | help

>Number:         17476
>Category:       bin
>Synopsis:       uudecode -i (no overwrite) flag bogus
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 18 12:00:01 PST 2000
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Chen
>Release:        All releases since 2.2
>Organization:
>Environment:

	

>Description:
The -i flag in uudecode has no effect except for printing "not overwritten".
It overwrites the file anyway.  This problem existed since the introduction
of the -i flag in uudecode.
	

>How-To-Repeat:
uudecode foo < somefile > foo.uu
touch foo
uudecode -i foo.uu
(uudecode will now tell you "foo" was not overwritten, but overwrite it anyway)
>Fix:
recommend the following patch: (should work on -STABLE and -CURRENT)
--- uudecode.c~	Sat Mar 18 14:50:48 2000
+++ uudecode.c	Sat Mar 18 14:51:16 2000
@@ -197,9 +197,10 @@
 		; /* print to stdout */
 
 	else {
-		if (iflag && !access(buf, F_OK))
+		if (iflag && !access(buf, F_OK)) {
 			(void)fprintf(stderr, "not overwritten: %s\n", buf);
-		if (!freopen(buf, "w", stdout) ||
+			freopen("/dev/null", "w", stdout);
+		} else if (!freopen(buf, "w", stdout) ||
 		    fchmod(fileno(stdout), mode&0666)) {
 			warn("%s: %s", buf, filename);
 			return(1);
	


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200003181952.OAA46459>