login: use calloc() when memory needs to be cleared
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit is contained in:
parent
0da0a5ed3b
commit
5941a0db06
|
@ -1159,10 +1159,8 @@ static void init_environ(struct login_context *cxt)
|
|||
termenv = xstrdup(termenv);
|
||||
|
||||
/* destroy environment unless user has requested preservation (-p) */
|
||||
if (!cxt->keep_env) {
|
||||
environ = xmalloc(sizeof(char *));
|
||||
memset(environ, 0, sizeof(char *));
|
||||
}
|
||||
if (!cxt->keep_env)
|
||||
environ = xcalloc(1, sizeof(char *));
|
||||
|
||||
xsetenv("HOME", pwd->pw_dir, 0); /* legal to override */
|
||||
xsetenv("USER", pwd->pw_name, 1);
|
||||
|
|
Loading…
Reference in New Issue