On Fri, Apr 24, 2009 at 12:27:49PM +0200, Aurelien Jarno wrote: [..snip..] > That said I don't fully understand POSIX here. What should happen if a > line in /etc/group needs more memory than sysconf(_SC_GETGR_R_SIZE_MAX)? > The line should be truncated? As far as I understand user can create as > many entries as he wants there, so _SC_GETGR_R_SIZE_MAX can only be > defined to an arbitrary value. The manpage (as well as posix) says:
The maximum needed size for buf can be found using sysconf(3) with the argument _SC_GETGR_R_SIZE_MAX. I don't understand how this is supposed to work with arbitrary large groups given that gr_mem is part of the buffer. It's probaly just a documentation bug that should read "minimum" instead of "maximum"? Since sysconf is allowed to return -1 we need to check for ERANE anyway, see e.g. [1]. Cheers, -- Guido [1] http://git.debian.org/?p=pkg-libvirt/libvirt.git;a=blob;f=debian/patches/0005-increase-buffer-on-ERANGE.patch;h=7b0d76354258ba6d5f45759444a5e6ba03680c70;hb=031b9c1f5491617ad17b4d74e2a039de37d982f6 -- To UNSUBSCRIBE, email to [email protected] with a subject of "unsubscribe". Trouble? Contact [email protected]

