initgroups() doesn't call setgid()

So you would end up with a gid of 0, with some additional groups.  Fix
that by calling setgid() after initgroups().