From wosch@cs.tu-berlin.de  Tue Apr  9 12:44:01 1996
Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13])
          by freefall.freebsd.org (8.7.3/8.7.3) with ESMTP id MAA06991
          for <FreeBSD-gnats-submit@freebsd.org>; Tue, 9 Apr 1996 12:44:00 -0700 (PDT)
Received: from caramba.cs.tu-berlin.de (wosch@caramba.cs.tu-berlin.de [130.149.17.12]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id VAA06676 for <FreeBSD-gnats-submit@freebsd.org>; Tue, 9 Apr 1996 21:32:41 +0200
Received: (from wosch@localhost) by campa.panke.de (8.6.12/8.6.12) id NAA01284; Tue, 9 Apr 1996 13:49:40 +0200
Message-Id: <199604091149.NAA01284@campa.panke.de>
Date: Tue, 9 Apr 1996 13:49:40 +0200
From: Wolfram Schneider <wosch@cs.tu-berlin.de>
Reply-To: wosch@cs.tu-berlin.de
To: FreeBSD-gnats-submit@freebsd.org
Subject: wc(1) exit if a file is not readable
X-Send-Pr-Version: 3.2

>Number:         1128
>Category:       bin
>Synopsis:       wc(1) exit if a file is not readable
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Apr  9 12:50:01 PDT 1996
>Closed-Date:    Fri Apr 12 01:29:13 PDT 1996
>Last-Modified:  Tue Nov 27 18:52:56 PST 2001
>Originator:     Wolfram Schneider
>Release:        FreeBSD 2.1-STABLE i386
>Organization:
>Environment:
>Description:
>How-To-Repeat:

bash$ touch a b c
bash$ chmod 0000 b
bash$ wc a b c
       0       0       0 a
wc: b: Permission denied

>Fix:

FreeBSD 1.1.5, NetBSD, Solaris print a warning.


--- 1.1	1996/04/09 11:41:10
+++ wc.c	1996/04/09 11:45:41
@@ -126,8 +126,10 @@
 	fd = STDIN_FILENO;
 	linect = wordct = charct = 0;
 	if (file) {
-		if ((fd = open(file, O_RDONLY, 0)) < 0)
-			err("%s: %s", file, strerror(errno));
+		if ((fd = open(file, O_RDONLY, 0)) < 0) {
+			warnx("%s: %s", file, strerror(errno));
+			return;
+		}
 		if (doword)
 			goto word;
 		/*
>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@lcs.mit.edu>
To: wosch@cs.tu-berlin.de
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: bin/1128: wc(1) exit if a file is not readable
Date: Tue, 9 Apr 1996 16:23:44 -0400

 <<On Tue, 9 Apr 1996 13:49:40 +0200, Wolfram Schneider <wosch@cs.tu-berlin.de> said:
 
 > +			warnx("%s: %s", file, strerror(errno));
 
 Or, even better,
 
 			warn("%s", file);
 
 -GAWollman
 
 --
 Garrett A. Wollman   | Shashish is simple, it's discreet, it's brief. ... 
 wollman@lcs.mit.edu  | Shashish is the bonding of hearts in spite of distance.
 Opinions not those of| It is a bond more powerful than absence.  We like people
 MIT, LCS, ANA, or NSA| who like Shashish.  - Claude McKenzie + Florent Vollant
State-Changed-From-To: open->closed 
State-Changed-By: wosch 
State-Changed-When: Fri Apr 12 01:29:13 PDT 1996 
State-Changed-Why:  
fixed in wc.c revision 1.3 
>Unformatted:
