Date: Thu, 9 Sep 1999 22:02:05 +0100 From: Ben Smithurst <ben@scientia.demon.co.uk> To: "Andy V. Oleynik" <andyo@prime.net.ua> Cc: freebsd-stable@freebsd.org Subject: Re: fclose(NULL) - 2 versions of FBSD & cc & 2 different behavours Message-ID: <19990909220205.A31044@lithium.scientia.demon.co.uk> In-Reply-To: <37D8124F.470722F9@prime.net.ua> References: <37D8124F.470722F9@prime.net.ua>
next in thread | previous in thread | raw e-mail | index | archive | help
Andy V. Oleynik wrote: > A lot of time ago my collegue wrote the c-prog intended to be ran > as cgi script. He did mistake in prog: > to check that file existed he opened it with fopen (why not access I > didnt > understand :) and after some action closed it with fclose. Upon > some condition as I said the file might not existed. So prog did > fclose(NULL) in fact. Now interesting thing. On the 2.2.7-R systems > having been compiled with 2.7.2.1 it never been crashed. But on > 3.2-S recently cvsupped & makeworlded latly having been compiled > with cc 2.7.2.3 it crashes with 10 SIG (as expected I beleave). > Somebody have a words of wisdom? *sigh* Did you think about reading the manual? NOTES fclose() does not handle NULL arguments; they will result in a segmenta- tion violation. This is intentional - it makes it easier to make sure programs written under FreeBSD are bug free. This behaviour is an imple- mentation detail, and programs should not rely upon it. -- Ben Smithurst | PGP: 0x99392F7D ben@scientia.demon.co.uk | key available from keyservers and | ben+pgp@scientia.demon.co.uk To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990909220205.A31044>