From: Alan Cox Date: Sat, 9 Apr 2016 16:01:23 +0000 (+0100) Subject: init: allow initgroups to fail X-Git-Url: https://git.ndcode.org/public/gitweb.cgi?a=commitdiff_plain;h=33938b6785a047b3e4b5e28346394e95f8175cef;p=FUZIX.git init: allow initgroups to fail --- diff --git a/Applications/util/init.c b/Applications/util/init.c index c5631c7b..5dd0d68b 100644 --- a/Applications/util/init.c +++ b/Applications/util/init.c @@ -743,8 +743,10 @@ static void spawn_login(struct passwd *pwd, const char *tty, const char *id) /* Don't leak utmp into the child */ endutent(); - if (initgroups(pwd->pw_name, pwd->pw_gid) == -1 && errno != ENOSYS) - exit(255); + /* We don't care if initgroups fails - it only grants extra rights */ + initgroups(pwd->pw_name, pwd->pw_gid); + + /* But we do care if these fail! */ if (setgid(pwd->pw_gid) == -1 || setuid(pwd->pw_uid) == -1) _exit(255);