[libvirt] [PATCH] Fix closedir usage in virNumaGetPages
Roman Bogorodskiy
bogorodskiy at gmail.com
Mon Jun 23 15:43:28 UTC 2014
Eric Blake wrote:
> On 06/23/2014 05:46 AM, Michal Privoznik wrote:
>
> >> - closedir(dir);
> >> + if (dir)
> >> + closedir(dir);
> >> VIR_FREE(path);
> >> return ret;
> >> }
> >>
> >
> > So why is free(NULL) safe on FreeBSD then? I'd call this a libc bug not
> > a libvirt one. But since even we already have such borken design
> > (remember our publir vir*Free() APIs?) I can live with this patch.
>
> free(NULL) is explicitly required by C (and therefore POSIX) to be safe.
> closedir(NULL) is intentionally unspecified by POSIX, and therefore
> unsafe. It would be nice if the two had similar requirements, but as
> POSIX was merely standardizing existing practice, we are stuck with them
> being different in behavior.
The patch is pushed now; thanks.
Roman Bogorodskiy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140623/7a494c54/attachment-0001.sig>
More information about the libvir-list
mailing list