Revert "main: drop privileges right after reading the config"
authorMukund Sivaraman <muks@banu.com>
Wed, 21 Apr 2010 14:40:56 +0000 (20:10 +0530)
committerMukund Sivaraman <muks@banu.com>
Wed, 21 Apr 2010 14:40:56 +0000 (20:10 +0530)
This reverts commit 7a9abc2a04dd8ed1f113aa9c803af24adfb22773. It should
fix the issue in bug #87.

src/main.c

index 2bd2cdb2470bd8a7f98f406111e4834e79fc8728..064b440dae4827e023465e7c985e567c6a83d2b7 100644 (file)
@@ -393,14 +393,6 @@ main (int argc, char **argv)
                 exit (EX_SOFTWARE);
         }
 
-        /* Switch to a different user if we're running as root */
-        if (geteuid () == 0) {
-                change_user (argv[0]);
-        } else {
-                log_message (LOG_WARNING,
-                             "Not running as root, so not changing UID/GID.");
-        }
-
         ret = setup_logging ();
         if (ret != 0) {
                 exit (EX_SOFTWARE);
@@ -446,6 +438,13 @@ main (int argc, char **argv)
                 exit (EX_OSERR);
         }
 
+        /* Switch to a different user if we're running as root */
+        if (geteuid () == 0)
+                change_user (argv[0]);
+        else
+                log_message (LOG_WARNING,
+                             "Not running as root, so not changing UID/GID.");
+
         if (child_pool_create () < 0) {
                 fprintf (stderr,
                          "%s: Could not create the pool of children.\n",