Subject: wall and no tty
To: None <tech-userlevel@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-userlevel
Date: 10/26/2004 20:03:06
--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Hi,
In rev 1.23, warn.c was changed to call check_sender(), to fix PR/7713.
Unfortunably this breaks warn when called from a script, which doesn't have a
tty (it will exit with "can't find your tty" error message). The attached
patch fix this, by not calling check_sender() if we're not on a tty.
Is it OK to commit ?
--
Manuel Bouyer <bouyer@antioche.eu.org>
NetBSD: 26 ans d'experience feront toujours la difference
--
--+HP7ph2BbKc20aGI
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff
Index: wall.c
===================================================================
RCS file: /cvsroot/src/usr.bin/wall/wall.c,v
retrieving revision 1.24
diff -u -r1.24 wall.c
--- wall.c 7 Aug 2003 11:17:14 -0000 1.24
+++ wall.c 26 Oct 2004 17:59:21 -0000
@@ -101,7 +101,8 @@
err(1, "setegid");
pw = getpwnam("nobody");
- (void)check_sender(&atime, getuid(), egid);
+ if (isatty(fileno(stdin)))
+ (void)check_sender(&atime, getuid(), egid);
while ((ch = getopt(argc, argv, "g:n")) != -1)
switch (ch) {
--+HP7ph2BbKc20aGI--