Date: Thu, 5 Oct 1995 07:20:34 +0800 (WST) From: Peter Wemm <peter@jhome.DIALix.COM> To: Joerg Wunsch <joerg_wunsch@uriah.heep.sax.de> Cc: Nate Williams <nate@rocky.sri.MT.net>, CVS-commiters@freefall.freebsd.org, cvs-lib@freefall.freebsd.org Subject: Re: cvs commit: src/lib/libc/stdio gets.c Message-ID: <Pine.BSF.3.91.951005071325.509C-100000@jhome.DIALix.COM> In-Reply-To: <199510042241.XAA04988@uriah.heep.sax.de>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 4 Oct 1995, J Wunsch wrote: > > As Nate Williams wrote: > > > > ... If you also want to take some more > > inspiration from NetBSD, add a static variable to the sources so the > > warning is printed at run-time only once. It is still annoying, but not > > continually annoying. > > huh? This has been there all the time: > > static int warned; > static char w[] = > "warning: this program uses gets(), which is unsafe.\r\n"; > > if (!warned) { > (void) write(STDERR_FILENO, w, sizeof(w) - 1); > warned = 1; > } Yeah, that's the bit of code that I wanted to nuke, but judging by Bruce's responce when I asked about that, I thought I'd play it safe and cover my backside. The way I see it, this warning is bad because there's no guarantee that the message is going to be printed if the code path that calls gets() in the first place isn't executed often. When it finally does, the poor user is left wondering why the hell the executable has suddenly printed this new error message in the middle of the program run. If it could be done via _init tricks or something at startup, then it would probably be OK, but that's not trivial with shared libraries... Oh well.. Anyway, my vote for deleting the run-time warning is on the record. -Peter > -- > 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?Pine.BSF.3.91.951005071325.509C-100000>