• E
    util: add virGetGroupList · 75c12564
    Eric Blake 提交于
    Since neither getpwuid_r() nor initgroups() are safe to call in
    between fork and exec (they obtain a mutex, but if some other
    thread in the parent also held the mutex at the time of the fork,
    the child will deadlock), we have to split out the functionality
    that is unsafe.  At least glibc's initgroups() uses getgrouplist
    under the hood, so the ideal split is to expose getgrouplist for
    use before a fork.  Gnulib already gives us a nice wrapper via
    mgetgroups; we wrap it once more to look up by uid instead of name.
    
    * bootstrap.conf (gnulib_modules): Add mgetgroups.
    * src/util/virutil.h (virGetGroupList): New declaration.
    * src/util/virutil.c (virGetGroupList): New function.
    * src/libvirt_private.syms (virutil.h): Export it.
    Signed-off-by: NEric Blake <eblake@redhat.com>
    75c12564
libvirt_private.syms 46.5 KB