]> skyeroc.xyz Git - dgamelaunch/commitdiff
use setgroups()
authorJoshua Kwan <joshk@triplehelix.org>
Fri, 2 Jan 2004 20:39:02 +0000 (20:39 +0000)
committerJoshua Kwan <joshk@triplehelix.org>
Fri, 2 Jan 2004 20:39:02 +0000 (20:39 +0000)
git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@42 db0b04b0-f4d1-0310-9a6d-de3e77497b0e

dgamelaunch.c

index 846e6fbc649235d6985114fcbc1f19e52379b511..466d0cab0dfebe2e7df50164722167ff6aa8a20e 100644 (file)
@@ -1072,8 +1072,23 @@ main (void)
     }
 
   /* shed privs. this is done immediately after chroot. */
-  setgid (newgid);
-  setuid (newuid);
+  if (setgroups(1, &newgid) == -1)
+  {
+    perror("setgroups");
+    exit(1);
+  }
+
+  if (setgid (1, newgid) == -1)
+  {
+    perror("setgid");
+    exit(1);
+  }
+
+  if (setuid (1, newuid) == -1)
+  {
+    perror("setuid");
+    exit(1);
+  }
 
   /* simple login routine, uses ncurses */
   if (readfile (0))