NetBSD-Bugs archive

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

bin/38207: fmt reports non-existing files erroneously



>Number:         38207
>Category:       bin
>Synopsis:       fmt reports non-existing files erroneously
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 09 14:20:00 +0000 2008
>Originator:     Aleksej Saushev <asau%inbox.ru@localhost>
>Release:        NetBSD 4.99.55
>Organization:
>Environment:
System: NetBSD asau.local 4.99.55 NetBSD 4.99.55 (KERN) #0: Mon Mar 3 22:32:55 
MSK 2008 asau%asau.local@localhost:/usr/obj/sys/arch/i386/compile/KERN i386
Architecture: i386
Machine: i386
>Description:
        "fmt this this this" results in this:

fmt: Cannot open `this': No such file or directory
fmt: Cannot open `this': No such file or directory
fmt: Cannot open `(null)': No such file or directory

>How-To-Repeat:
        Try it!
>Fix:
        Apply patch below:

Index: fmt.c
===================================================================
RCS file: /cvsroot/src/usr.bin/fmt/fmt.c,v
retrieving revision 1.28
diff -u -u -r1.28 fmt.c
--- fmt.c       15 Dec 2007 19:44:50 -0000      1.28
+++ fmt.c       9 Mar 2008 14:16:03 -0000
@@ -157,8 +157,8 @@
                oflush();
                return 0;
        }
-       while (argc--) {
-               if ((fi = fopen(*argv++, "r")) == NULL) {
+       for (;argc; argc--, argv++) {
+               if ((fi = fopen(*argv, "r")) == NULL) {
                        warn("Cannot open `%s'", *argv);
                        errs++;
                        continue;



Home | Main Index | Thread Index | Old Index