All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael Kerrisk <mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: Thomas Jarosch <thomas.jarosch-XXsH3GEs1jrby3iVrkZq2A@public.gmane.org>
Cc: linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [man-pages PATCH] Add note about calling fclose(NULL)
Date: Sat, 02 Feb 2013 02:11:08 +0100	[thread overview]
Message-ID: <510C67AC.9040409@gmail.com> (raw)
In-Reply-To: <3571094.25JfT3zTrV@storm>

On 01/31/2013 09:26 AM, Thomas Jarosch wrote:
> On Thursday, 31. January 2013 01:50:49 Michael Kerrisk wrote:
>>> diff --git a/man3/fclose.3 b/man3/fclose.3
>>> index 1bdf0a5..6945e89 100644
>>> --- a/man3/fclose.3
>>> +++ b/man3/fclose.3
>>> @@ -97,6 +97,10 @@ on disk the kernel buffers must be flushed too, for
>>> example, with> 
>>>  .BR sync (2)
>>>  or
>>>  .BR fsync (2).
>>>
>>> +Also it's undefined behavior to call
>>> +.BR fclose ()
>>> +with a NULL pointer.
>>> +
>>
>> Could you supply some explanation of why you think this patch is required?
> 
> I always thought fclose(NULL) behaves like free(NULL)
> and even sent a patch for the "perf" utility assuming this.
> Luckily Arnaldo caught the error before applying the patch,
> at least in one case.
> 
> Also fclose(NULL) "works" fine on HP-UX and Solaris,
> glibc will die with a segfault.

Thomas,

Can you define "works" with respect to those OSes? Their man pages seems 
to say nothing about fclose(NULL). At this stage, I'm not convinced that
adding this text to the man page is really required.

Thanks,

Michael


--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2013-02-02  1:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-29 16:24 [man-pages PATCH] Add note about calling fclose(NULL) Thomas Jarosch
2013-01-29 18:44 ` Mike Frysinger
     [not found]   ` <201301291344.29011.vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
2013-02-01  9:43     ` Thomas Jarosch
2013-02-02  9:35       ` Mike Frysinger
2013-01-31  0:50 ` Michael Kerrisk (man-pages)
     [not found]   ` <CAKgNAkiQsWWWTfLWeixN5+GcwkfP6UX+AYdL4HY6beq7rdpUxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-01-31  8:26     ` Thomas Jarosch
2013-02-02  1:11       ` Michael Kerrisk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=510C67AC.9040409@gmail.com \
    --to=mtk.manpages-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=thomas.jarosch-XXsH3GEs1jrby3iVrkZq2A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.