Date: Mon, 18 Nov 1996 23:41:47 +0100 (MET) From: J Wunsch <j@uriah.heep.sax.de> To: freebsd-bugs@FreeBSD.org (FreeBSD bugs list) Cc: jin@george.lbl.gov Subject: Re: diff somehow does not work properly in 2.2-ALPHA Message-ID: <199611182241.XAA02531@uriah.heep.sax.de> In-Reply-To: <96Nov18.120623pst.177557@crevenia.parc.xerox.com> from Bill Fenner at "Nov 18, 96 12:06:17 pm"
next in thread | previous in thread | raw e-mail | index | archive | help
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. ;-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199611182241.XAA02531>