[hackers] [utmp] Use setegid instead of setgid || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sun, 22 Feb 2015 17:47:31 +0100 (CET)

commit 2583293ac5eb66e988cb0492ca707779b8ea2be6
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
Date: Sun Feb 22 16:25:34 2015 +0000

    Use setegid instead of setgid
    
    The definition of seteigd is better than the definition of
    setgid, which behaviour depends of _POSIX_SAVED_IDS.

diff --git a/bsd.c b/bsd.c
index 754d1d0..a882f31 100644
--- a/bsd.c
+++ b/bsd.c
_AT_@ -44,9 +44,9 @@ addutmp(void)
         strncpy(utmp.ut_host, host, sizeof(utmp.ut_host));
         time(&utmp.ut_time);
 
- setgid(egid);
+ setegid(egid);
         login(&utmp);
- setgid(gid);
+ setegid(gid);
 }
 
 void
diff --git a/posix.c b/posix.c
index 8f904c4..7d43250 100644
--- a/posix.c
+++ b/posix.c
_AT_@ -98,10 +98,10 @@ addutmp(void)
         utmp.ut_tv.tv_usec = 0;
          /* don't use no standard fields host and session */
 
- setgid(egid);
+ setegid(egid);
         if(!pututxline(&utmp))
                 die("error adding utmp entry:%s", strerror(errno));
- setgid(gid);
+ setegid(gid);
         endutxent();
 }
 
diff --git a/utmp.c b/utmp.c
index 75c35f5..9493e36 100644
--- a/utmp.c
+++ b/utmp.c
_AT_@ -14,11 +14,6 @@
 #include <sys/wait.h>
 
 
-#ifndef _POSIX_SAVED_IDS
-#error "This program needs saved id behaviour"
-#endif
-
-
 struct passwd *pw;
 gid_t egid, gid;
 
Received on Sun Feb 22 2015 - 17:47:31 CET

This archive was generated by hypermail 2.3.0 : Sun Feb 22 2015 - 17:48:09 CET