login: simplify string handling

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
Sami Kerola 2019-07-21 19:12:03 +01:00 committed by Karel Zak
parent 0675f52ab5
commit 1aaee548e3
1 changed files with 1 additions and 4 deletions

View File

@ -1355,10 +1355,7 @@ int main(int argc, char **argv)
/* if the shell field has a space: treat it like a shell script */
if (strchr(pwd->pw_shell, ' ')) {
buff = xmalloc(strlen(pwd->pw_shell) + 6);
strcpy(buff, "exec ");
strcat(buff, pwd->pw_shell);
xasprintf(&buff, "exec %s", pwd->pw_shell);
childArgv[childArgc++] = "/bin/sh";
childArgv[childArgc++] = "-sh";
childArgv[childArgc++] = "-c";