From: Matthew Vernon Date: Tue, 7 Jan 2014 14:29:13 +0000 (+0000) Subject: check return values of setgid and setuid X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=xtrlock.git;a=commitdiff_plain;h=4d5f368e87b2fcc17dfd4fdca112207c6cc7550e check return values of setgid and setuid --- diff --git a/xtrlock.c b/xtrlock.c index 3d5ce70..7598560 100644 --- a/xtrlock.c +++ b/xtrlock.c @@ -108,10 +108,10 @@ int main(int argc, char **argv){ /* logically, if we need to do the following then the same applies to being installed setgid shadow. we do this first, because of a bug in linux. --jdamery */ - setgid(getgid()); + if (setgid(getgid())) { perror("setgid"); exit(1); } /* we can be installed setuid root to support shadow passwords, and we don't need root privileges any longer. --marekm */ - setuid(getuid()); + if (setuid(getuid())) { perror("setuid"); exit(1); } if (strlen(pw->pw_passwd) < 13) { fputs("password entry has no pwd\n",stderr); exit(1);