- (dtucker) [uidswap.c] Don't test dropping of gids for the root user or
   on Cygwin.  Cygwin parts from vinschen at redhat com; ok djm@
diff --git a/uidswap.c b/uidswap.c
index 44c4cb6..fa3d7a3 100644
--- a/uidswap.c
+++ b/uidswap.c
@@ -200,10 +200,12 @@
 		fatal("setuid %u: %.100s", (u_int)pw->pw_uid, strerror(errno));
 #endif
 
+#ifndef HAVE_CYGWIN
 	/* Try restoration of GID if changed (test clearing of saved gid) */
-	if (old_gid != pw->pw_gid &&
+	if (old_gid != pw->pw_gid && pw->pw_uid != 0 &&
 	    (setgid(old_gid) != -1 || setegid(old_gid) != -1))
 		fatal("%s: was able to restore old [e]gid", __func__);
+#endif
 
 	/* Verify GID drop was successful */
 	if (getgid() != pw->pw_gid || getegid() != pw->pw_gid) {