From 9aa3a11857109297b521d0a8926dd90361b991ed Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 18 May 2017 12:28:51 +0300 Subject: [PATCH] quotaops: check setgid/setuid return code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit setgid/setuid syscalls may fail for different reasons, do not ignore these errors. Signed-off-by: Dmitry V. Levin Signed-off-by: Jan Kara Signed-off-by: Petr Písař --- quotaops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/quotaops.c b/quotaops.c index 56cf622..5e6026e 100644 --- a/quotaops.c +++ b/quotaops.c @@ -218,8 +218,10 @@ int editprivs(char *tmpfile) int i; sigprocmask(SIG_SETMASK, &omask, NULL); - setgid(getgid()); - setuid(getuid()); + if (setgid(getgid())) + die(1, _("%s failed: %s\n"), "setgid", strerror(errno)); + if (setuid(getuid())) + die(1, _("%s failed: %s\n"), "setuid", strerror(errno)); if (!(ed = getenv("VISUAL"))) if (!(ed = getenv("EDITOR"))) ed = _PATH_VI; -- 2.9.4