]> git.eshelyaron.com Git - emacs.git/commitdiff
* movemail.c (main): Use setregid, as setegid is missing on HP-UX (Bug#6811).
authorChong Yidong <cyd@stupidchicken.com>
Sun, 23 Jan 2011 22:58:52 +0000 (17:58 -0500)
committerChong Yidong <cyd@stupidchicken.com>
Sun, 23 Jan 2011 22:58:52 +0000 (17:58 -0500)
Suggested by Peter O'Gorman.

lib-src/ChangeLog
lib-src/movemail.c

index 421bdc06a43d3b95c221e36b440ddb2b0befedba..aa5ae5ba7e66e91f4b6ab1181071f5bff2a3ced8 100644 (file)
@@ -1,3 +1,8 @@
+2011-01-23  Chong Yidong  <cyd@stupidchicken.com>
+
+       * movemail.c (main): Use setregid instead of setegid, which is
+       missing on older systems.  Suggested by Peter O'Gorman (Bug#6811).
+
 2011-01-02  Glenn Morris  <rgm@gnu.org>
 
        * ebrowse.c (version) <emacs_copyright>:
index 3aebf79c6c8614d81c5de772d67105fbab4b167d..5fcc6de17a63b750fda4407f09d59c325c77c5bf 100644 (file)
@@ -360,7 +360,7 @@ main (argc, argv)
       time_t touched_lock, now;
 #endif
 
-      if (setuid (getuid ()) < 0 || setegid (real_gid) < 0)
+      if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)
        fatal ("Failed to drop privileges", 0, 0);
 
 #ifndef MAIL_USE_MMDF
@@ -387,7 +387,7 @@ main (argc, argv)
       if (outdesc < 0)
        pfatal_with_name (outname);
 
-      if (setegid (priv_gid) < 0)
+      if (setregid (-1, priv_gid) < 0)
        fatal ("Failed to regain privileges", 0, 0);
 
       /* This label exists so we can retry locking
@@ -484,7 +484,7 @@ main (argc, argv)
 #endif
 
       /* Prevent symlink attacks truncating other users' mailboxes */
-      if (setegid (real_gid) < 0)
+      if (setregid (-1, real_gid) < 0)
        fatal ("Failed to drop privileges", 0, 0);
 
       /* Check to make sure no errors before we zap the inbox.  */
@@ -519,7 +519,7 @@ main (argc, argv)
 #endif /* not MAIL_USE_SYSTEM_LOCK */
 
       /* End of mailbox truncation */
-      if (setegid (priv_gid) < 0)
+      if (setregid (-1, priv_gid) < 0)
        fatal ("Failed to regain privileges", 0, 0);
 
 #ifdef MAIL_USE_MAILLOCK