]> xenbits.xensource.com Git - libvirt.git/commit
util: extend virGetUserID and virGetGroupID to support names and IDs
authorMarcelo Cerri <mhcerri@linux.vnet.ibm.com>
Mon, 8 Oct 2012 20:37:01 +0000 (17:37 -0300)
committerEric Blake <eblake@redhat.com>
Mon, 8 Oct 2012 21:10:09 +0000 (15:10 -0600)
commit0b237296ef8a702df238d97fb9ab2534c8820330
tree3aef14e77d356a44b6d5314990407686817a8f0b
parent458c499841505c340a0774914998891b48985d39
util: extend virGetUserID and virGetGroupID to support names and IDs

This patch updates virGetUserID and virGetGroupID to be able to parse a
user or group name in a similar way to coreutils' chown. This means that
a numeric value with a leading plus sign is always parsed as an ID,
otherwise the functions try to parse the input first as a user or group
name and if this fails they try to parse it as an ID.

This patch includes Peter Krempa's changes to correctly handle errors
returned by getpwnam_r and getgrnam_r.
src/util/util.c