NetBSD-Bugs archive

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

bin/53226: cat.c if block never true



>Number:         53226
>Category:       bin
>Synopsis:       cat.c if block never true
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Apr 29 04:55:00 +0000 2018
>Originator:     Edgar Pettijohn
>Release:        7.1.2
>Organization:
>Environment:
NetBSD laptop.my.domain 7.1.2 NetBSD 7.1.2 (GENERIC.201803151611Z) amd64

>Description:
If block is never true.

A grep of the tree shows there are potentially more. It also seems there isn't consensus on the proper check. Should it be (fclose(fd) != 0) or (fclose(fd) == EOF)?
>How-To-Repeat:

>Fix:
laptop$ cvs diff -u cat.c
Index: cat.c
===================================================================
RCS file: /cvsroot/src/bin/cat/cat.c,v
retrieving revision 1.57
diff -u -r1.57 cat.c
--- cat.c       16 Jun 2016 00:52:37 -0000      1.57
+++ cat.c       29 Apr 2018 04:42:57 -0000
@@ -134,7 +134,7 @@
                cook_args(argv);
        else
                raw_args(argv);
-       if (fclose(stdout))
+       if (fclose(stdout) != 0)
                err(EXIT_FAILURE, "stdout");
        return rval;
 }




Home | Main Index | Thread Index | Old Index