From owner-freebsd-bugs Mon Nov 18 16:51:01 1996 Return-Path: owner-bugs Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id QAA29479 for bugs-outgoing; Mon, 18 Nov 1996 16:51:01 -0800 (PST) Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id QAA29461 for ; Mon, 18 Nov 1996 16:50:47 -0800 (PST) Received: from sax.sax.de (sax.sax.de [193.175.26.33]) by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id BAA02349; Tue, 19 Nov 1996 01:49:59 +0100 Received: (from uucp@localhost) by sax.sax.de (8.6.12/8.6.12-s1) with UUCP id BAA19047; Tue, 19 Nov 1996 01:49:58 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.8.2/8.6.9) id XAA02531; Mon, 18 Nov 1996 23:41:47 +0100 (MET) From: J Wunsch Message-Id: <199611182241.XAA02531@uriah.heep.sax.de> Subject: Re: diff somehow does not work properly in 2.2-ALPHA To: freebsd-bugs@FreeBSD.org (FreeBSD bugs list) Date: Mon, 18 Nov 1996 23:41:47 +0100 (MET) Cc: jin@george.lbl.gov Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <96Nov18.120623pst.177557@crevenia.parc.xerox.com> from Bill Fenner at "Nov 18, 96 12:06:17 pm" X-Phone: +49-351-2012 669 X-PGP-Fingerprint: DC 47 E6 E4 FF A6 E9 8F 93 21 E0 7D F9 12 D6 4E X-Mailer: ELM [version 2.4ME+ PL17 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-bugs@FreeBSD.org X-Loop: FreeBSD.org Precedence: bulk As Bill Fenner wrote: > Someone closed stdout, right near the beginning of the program. It > might even be before main() gets control, my untrained eye can't say. > It's the last system call before a readlink() of /etc/malloc.conf, > which might or might not point to something. A section of the > interpreted ktrace: > 13410 diff CALL close(0x1) > 13410 diff RET close 0 > 13410 diff CALL readlink(0x8077d3a,0xefbfd8f0,0x3f) > 13410 diff NAMI "/etc/malloc.conf" > 13410 diff RET readlink -1 errno 2 No such file or directory > > Since stdout is closed, diff can't write to it later when it wants to > display its output, thus "write error". Seems to be intentional. Somehow, writing to the output file failed: ... val = compare_files (0, argv[optind], 0, argv[optind + 1], 0); /* Print any messages that were saved up for last. */ print_message_queue (); check_stdout (); exit (val); return val; } ...with: static void check_stdout () { if (ferror (stdout) || fclose (stdout) != 0) fatal ("write error"); } (The malloc is supposedly called as part of the fprintf().) -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)