Subject: Re: Vi still can't remove its own vi-recover files from NFS /var/tmp
To: NetBSD-current Discussion List <current-users@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: current-users
Date: 01/23/2004 16:19:42
[ On Friday, January 23, 2004 at 21:24:38 (+0100), Christian Biere wrote: ]
> Subject: Re: Vi still can't remove its own vi-recover files from NFS /var/tmp
>
> In -current you'll find isatty() in the vi sources and in also in
> libc/stdio/makebuf.c. Have you tried setting a breakpoint at
> isatty and tcgetattr when running vi in gdb? I've just looked at
> cvsweb.netbsd.org and even *very* old version of those sources
> use isatty(). Is your grep broken? ;-)

No, but according to my shell history my command-line was (missed the
"xargs").  :-(

Thanks for correcting me!

Reading the code in makebuf.c though makes me wonder why it's calling
isatty() on anything that's not a character device.

Following the code path....

	if (fp->_file < 0 || fstat(fp->_file, &st) < 0) {

[[...]]

	/* could be a tty iff it is a character device */
	*couldbetty = S_ISCHR(st.st_mode);

[[...]]

	if (couldbetty && isatty(fp->_file))


(makebuf.c hasn't changed since 1999/09/20, so long before my first post)

-- 
						Greg A. Woods

+1 416 218-0098                  VE3TCP            RoboHack <woods@robohack.ca>
Planix, Inc. <woods@planix.com>          Secrets of the Weird <woods@weird.com>