From owner-freebsd-stable Thu Sep 9 18:43:59 1999 Delivered-To: freebsd-stable@freebsd.org Received: from scientia.demon.co.uk (scientia.demon.co.uk [212.228.14.13]) by hub.freebsd.org (Postfix) with ESMTP id 034531530F for ; Thu, 9 Sep 1999 18:43:53 -0700 (PDT) (envelope-from ben@scientia.demon.co.uk) Received: from lithium.scientia.demon.co.uk ([192.168.0.3] ident=exim) by scientia.demon.co.uk with esmtp (Exim 3.032 #1) id 11PBKb-000Av5-00; Thu, 09 Sep 1999 22:02:09 +0100 Received: (from ben) by lithium.scientia.demon.co.uk (Exim 3.032 #1) id 11PBKY-000886-00; Thu, 09 Sep 1999 22:02:06 +0100 Date: Thu, 9 Sep 1999 22:02:05 +0100 From: Ben Smithurst To: "Andy V. Oleynik" 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> References: <37D8124F.470722F9@prime.net.ua> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.6i In-Reply-To: <37D8124F.470722F9@prime.net.ua> Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG 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