$ doas doas -su _sndio
doas: mpty: command not found
The fix is easy: just strdup() the pw_shell field value.
okay tedu@, tweaks from & okay natano@
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;