[libvirt] FreeBSD and sysconf(_SC_GETPW_R_SIZE_MAX)

Eric Blake eblake at redhat.com
Mon May 16 21:55:54 UTC 2011


On 05/16/2011 03:03 PM, Eric Blake wrote:
>> getpwnam() returns ERANGE if the allocated buffer is too small. So
>> we should do something along the lines of
>>
>>     size_t len = sysconf(_SC_GETPW_R_SIZE_MAX)
> 
> Guarded by #ifdef, and defaulting to -1 if _SC_GETPW_R_SIZE_MAX is not
> defined (since it is a handy extension, but not present everywhere).

Or not - we only use it inside #if HAVE_FUNC_GETPWNAM_R and friends; so
far, all platforms that have the *_r functions also happen to have a
decent set of sysconf() names where we aren't running into compilation
errors by trying to use _SC_GETPW_R_SIZE_MAX.

> But indeed this is the correct response.

I've posted
https://www.redhat.com/archives/libvir-list/2011-May/msg01074.html

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110516/ab844d64/attachment-0001.sig>


More information about the libvir-list mailing list