]> git.armaanb.net Git - opendoas.git/commitdiff
fix some more fallout from setting path in setusercontext. restore previous behavior...
authortedu <tedu>
Sat, 29 Jun 2019 22:35:37 +0000 (22:35 +0000)
committerDuncan Overbruck <mail@duncano.de>
Sat, 19 Oct 2019 13:00:30 +0000 (15:00 +0200)
doas.c

diff --git a/doas.c b/doas.c
index 28954ecb6c7aee7a3db12ebf871a6e5e00782528..75882746e9ef7a95dc4b023bcb37e683ad48c4a9 100644 (file)
--- a/doas.c
+++ b/doas.c
@@ -500,10 +500,13 @@ main(int argc, char **argv)
 
        envp = prepenv(rule, mypw, targpw);
 
+       /* setusercontext set path for the next process, so reset it for us */
        if (rule->cmd) {
-               /* do this again after setusercontext reset it */
                if (setenv("PATH", safepath, 1) == -1)
                        err(1, "failed to set PATH '%s'", safepath);
+       } else {
+               if (setenv("PATH", formerpath, 1) == -1)
+                       err(1, "failed to set PATH '%s'", formerpath);
        }
        execvpe(cmd, argv, envp);
        if (errno == ENOENT)