Date: Tue, 25 Feb 1997 09:57:26 +0100 From: j@uriah.heep.sax.de (J Wunsch) To: freebsd-hackers@freefall.freebsd.org Subject: Re: MALLOC(3) writes to stderr... Message-ID: <Mutt.19970225095726.j@uriah.heep.sax.de> In-Reply-To: <199702250755.QAA20017@sirius.sbl.cl.nec.co.jp>; from Naoki Hamada on Feb 25, 1997 16:55:47 %2B0900 References: <199702250755.QAA20017@sirius.sbl.cl.nec.co.jp>
next in thread | previous in thread | raw e-mail | index | archive | help
As Naoki Hamada wrote: > Malloc(3) of 2.2-GAMMA writes error/warning messages to stderr. There > is a daemon named jserver, which provides translations between > Japanese characters, which does close stderr before opening its > dictionary files. Sometimes jserver gets its dictionary file > completely damaged by malloc's error/warning message. Hmm, i think it's a common misconception in Unix that everybody blindly assumes that file descriptors 0, 1, and 2 refer to stdin, stdout, and stderr respectively. OTOH, there's no opportunity for a library module to check where stderr really goes (or whether it has been closed). I bet malloc isn't the only library module that would write there. Your safest bet is to never close these descriptors, but redirect /dev/null on them. So, they remain `reserved'. Of course, you should also fix the malloc problems. Many people tend to use /etc/malloc.conf -> AJ these days, just for grins, and this would cause your daemon to fall over with a coredump, but with no indication for why it actually dumped core. (This also happened with inetd some day.) -- 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?Mutt.19970225095726.j>