From 05f088613bebc9fb743c309e9b9390d376387f1c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Eivind=20N=C3=A6ss?= Date: Mon, 20 Sep 2021 10:01:55 -0700 Subject: [PATCH] Fixing GCC compile warning with unused result from setgid/setuid. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Eivind Næss --- pppd/plugins/passprompt.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pppd/plugins/passprompt.c b/pppd/plugins/passprompt.c index dae3268..743c087 100644 --- a/pppd/plugins/passprompt.c +++ b/pppd/plugins/passprompt.c @@ -35,7 +35,7 @@ static int promptpass(char *user, char *passwd) { int p[2]; pid_t kid; - int readgood, wstat; + int readgood, wstat, ret; ssize_t red; if (promptprog_refused || promptprog[0] == 0 || access(promptprog, X_OK) < 0) @@ -60,8 +60,14 @@ static int promptpass(char *user, char *passwd) sys_close(); closelog(); close(p[0]); - seteuid(getuid()); - setegid(getgid()); + ret = seteuid(getuid()); + if (ret != 0) { + warn("Couldn't set effective user id"); + } + ret = setegid(getgid()); + if (ret != 0) { + warn("Couldn't set effective user id"); + } argv[0] = promptprog; argv[1] = user; argv[2] = remote_name; -- 2.39.2