diff options
author | Sami Kerola | 2019-07-21 20:12:03 +0200 |
---|---|---|
committer | Karel Zak | 2019-07-24 11:11:29 +0200 |
commit | 1aaee548e3cbe00a084103792b03605182eefd04 (patch) | |
tree | 07eb5abd8550b62950b4ab4ea8f75f92eb21b347 | |
parent | last: replace strncat() with more robust mem2strcpy() (diff) | |
download | kernel-qcow2-util-linux-1aaee548e3cbe00a084103792b03605182eefd04.tar.gz kernel-qcow2-util-linux-1aaee548e3cbe00a084103792b03605182eefd04.tar.xz kernel-qcow2-util-linux-1aaee548e3cbe00a084103792b03605182eefd04.zip |
login: simplify string handling
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r-- | login-utils/login.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/login-utils/login.c b/login-utils/login.c index ce112b54e..6b9d27e3e 100644 --- a/login-utils/login.c +++ b/login-utils/login.c @@ -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"; |