+{
+ if (userid) {
+ if (setgid(gid)!=0)
+ fatal_perror("can't set gid to %ld",(long)gid);
+ if (initgroups(userid, gid) < 0)
+ fatal_perror("initgroups");
+ if (setuid(uid)!=0) {
+ fatal_perror("can't set uid to \"%s\"",userid);
+ }
+ assert(getuid() == uid);
+ assert(geteuid() == uid);
+ assert(getgid() == gid);
+ assert(getegid() == gid);
+ }
+}
+
+/* Become a daemon, if necessary */
+static void become_daemon(void)