If you setuid to a non-zero value first(meaning you're no longer root),
then call setgroups, the effective uid of the process
is now no longer root, meaning that the internal setgid call fails
This also removes the duplicated if loop
Closes-Bug: #1628360
Change-Id: I5d66fccd9ffb07df0c2e4435ec3da767b3b61117