]> git.armaanb.net Git - opendoas.git/blobdiff - doas.c
minor configure tweaks
[opendoas.git] / doas.c
diff --git a/doas.c b/doas.c
index 05d2b93707dabe49276ae2cd3e37db7d4731d0e4..fa0eafb4970ccff8a5bad147ef910b7aa3984c45 100644 (file)
--- a/doas.c
+++ b/doas.c
@@ -246,7 +246,7 @@ main(int argc, char **argv)
 
        setprogname("doas");
 
-       if (pledge("stdio rpath getpw tty proc exec id", NULL) == -1)
+       if (pledge("stdio rpath getpw tty recvfd proc exec id", NULL) == -1)
                err(1, "pledge");
 
        /* closefrom(STDERR_FILENO + 1); */
@@ -311,9 +311,11 @@ main(int argc, char **argv)
 
        if (sflag) {
                sh = getenv("SHELL");
-               if (sh == NULL || *sh == '\0')
-                       shargv[0] = pw->pw_shell;
-               else
+               if (sh == NULL || *sh == '\0') {
+                       shargv[0] = strdup(pw->pw_shell);
+                       if (shargv[0] == NULL)
+                               err(1, NULL);
+               } else
                        shargv[0] = sh;
                argv = shargv;
                argc = 1;