Date: Tue, 9 Apr 1996 13:49:40 +0200 From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: FreeBSD-gnats-submit@freebsd.org Subject: bin/1128: wc(1) exit if a file is not readable Message-ID: <199604091149.NAA01284@campa.panke.de> Resent-Message-ID: <199604091950.MAA07434@freefall.freebsd.org>
index | next in thread | raw e-mail
>Number: 1128
>Category: bin
>Synopsis: wc(1) exit if a file is not readable
>Confidential: yes
>Severity: serious
>Priority: medium
>Responsible: freebsd-bugs
>State: open
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Tue Apr 9 12:50:01 PDT 1996
>Last-Modified:
>Originator: Wolfram Schneider
>Organization:
>Release: FreeBSD 2.1-STABLE i386
>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;
/*
>Audit-Trail:
>Unformatted:
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199604091149.NAA01284>
