Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 9 Sep 1998 21:59:10 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        cracauer@cons.org, current@FreeBSD.ORG
Subject:   Re: Regarding fclose(NULL)
Message-ID:  <199809091159.VAA22245@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I plan to change fclose so that it doesn't dump core on fclose(NULL). 

Aargh, no.

>For reasoning and actual patch see PR bin/7742.

I thought it was too obviously wrong to comment.  "Fixing" fclose(NULL)
has only slightly less negative worth than "fixing" strlen(NULL).
Careful programmers won't call fclose() with a NULL arg, since that
gives undefined behaviour, so they won't benefit from the change.
Careless programmers won't check that fclose() succeeds, so they will
get a negative benefit (loss of the core dump).

The man page is not incomplete.  It says that fclose() works on
streams.  NULL is not a stream.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199809091159.VAA22245>