This supercedes a patch I sent yesterday titled:
[PATCH] Call initgroups for qemu's uid prior to exec
https://www.redhat.com/archives/libvir-list/2010-December/msg00846.html
The first patch modifies the lowlevel error logging functions so that
they preserve the value of errno. This is necessary because a later
patch will rely on errno still being set after returning from a
function that logs an error.
The second creates a new utility function, for the purpose of
centralizing/standardizing use of initgroups to cause a forked process
run as a different uid to be a member of *all* groups containing that
uid as a member.
The 3rd patch changes two separate places in the code to use this new
utility function, in both cases fixing some already (or eventually to
be) encountered bugs.