commit 2583293ac5eb66e988cb0492ca707779b8ea2be6
parent 4a855c000f1d300a44c784ed88d78a11d41cdca7
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sun, 22 Feb 2015 16:25:34 +0000
Use setegid instead of setgid
The definition of seteigd is better than the definition of
setgid, which behaviour depends of _POSIX_SAVED_IDS.
Diffstat:
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/bsd.c b/bsd.c
@@ -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
@@ -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
@@ -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;