Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.ecn.uoknor.edu!news.ysu.edu!news.cps.udayton.edu!news.engr.udayton.edu!blackbird.afit.af.mil!zombie.ncsc.mil!news.mathworks.com!newsfeed.internetmci.com!info.ucla.edu!news.cs.ucla.edu!twinsun!not-for-mail From: eggert@twinsun.com (Paul Eggert) Newsgroups: comp.unix.bsd.freebsd.misc,comp.unix.bsd.netbsd.misc Subject: Re: diff3 freopen Date: 2 May 1996 16:23:04 -0700 Organization: Twin Sun Inc, El Segundo, CA, USA Lines: 26 Message-ID: <4mbg4o$t6t@bird.twinsun.com> References: <199605022206.PAA17886@paris.CS.Berkeley.EDU> NNTP-Posting-Host: 192.54.239.30 Xref: euryale.cc.adfa.oz.au comp.unix.bsd.freebsd.misc:18585 comp.unix.bsd.netbsd.misc:3471 Date: Thu, 2 May 1996 15:06:46 -0700 From: Josh MacDonald <jmacd@cs.berkeley.edu> I noticed that diff3 will call freopen on the standard input even when the standard input is closed. I have a program which is calling diff3 with its standard input closed and on some operating systems, (NetBSD and FreeBSD), this fails, the ferror call will return true after reading the file. I don't know who's bug this is, It's a bug in FreeBSD/NetBSD. The C Standard says ``The `freopen' function first attempts to close any file that is associated with the specified stream. Failure to close the file successfully is ignored. The error and end-of-file indicators for the stream are cleared.'' Perhaps you can send a bug report to the FreeBSD/NetBSD maintainers; I don't know the procedure. b) I should not close stdin before fork/execing diff3. Yes, that should work around the bug. c) Diff3 should not call freopen Unfortunately, if that freopen is changed to fopen, I think it may break on some _other_ buggy systems when stdin is closed. I'll try to think of a workaround.