static void __dead
usage(void)
{
- fprintf(stderr, "usage: doas [-nsv] [-a style] [-C config] [-u user]"
- " command [args]\n");
+ fprintf(stderr, "usage: doas [-nsv] "
+#ifdef HAVE_BSD_AUTH_H
+ "[-a style] "
+#endif
+ "[-C config] [-u user] command [args]\n");
exit(1);
}
if (pledge("stdio rpath getpw tty recvfd proc exec id", NULL) == -1)
err(1, "pledge");
- /* closefrom(STDERR_FILENO + 1); */
+ closefrom(STDERR_FILENO + 1);
uid = getuid();
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;