Re: [man-pages PATCH] Add note about calling fclose(NULL)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

Cheers,
Thomas

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


[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux