We need to initialize the "save" member in the list for GECOS fields.

If the user deletes a field while editing (as an easy way of making
that field empty) then "save" for that field will not get initialized
before referencing it when constructing the new GECOS field.
This commit is contained in:
kim 1998-08-10 23:21:05 +00:00
parent af575980ab
commit 1e454491c8
2 changed files with 9 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: field.c,v 1.6 1998/07/26 15:13:14 mycroft Exp $ */
/* $NetBSD: field.c,v 1.7 1998/08/10 23:21:05 kim Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: field.c,v 1.6 1998/07/26 15:13:14 mycroft Exp $");
__RCSID("$NetBSD: field.c,v 1.7 1998/08/10 23:21:05 kim Exp $");
#endif
#endif /* not lint */
@ -220,9 +220,7 @@ p_gecos(p, pw, ep)
ENTRY *ep;
{
if (!*p)
ep->save = "";
else if (!(ep->save = strdup(p))) {
if (!(ep->save = strdup(p))) {
warnx("can't save entry");
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: table.c,v 1.4 1997/10/18 12:49:10 lukem Exp $ */
/* $NetBSD: table.c,v 1.5 1998/08/10 23:21:05 kim Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)table.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: table.c,v 1.4 1997/10/18 12:49:10 lukem Exp $");
__RCSID("$NetBSD: table.c,v 1.5 1998/08/10 23:21:05 kim Exp $");
#endif
#endif /* not lint */
@ -57,10 +57,10 @@ ENTRY list[] = {
{ "class", p_class, 1, 5, e1, },
{ "change", p_change, 1, 6, NULL, },
{ "expire", p_expire, 1, 6, NULL, },
{ "full name", p_gecos, 0, 9, e2, },
{ "office phone", p_gecos, 0, 12, e2, },
{ "home phone", p_gecos, 0, 10, e2, },
{ "location", p_gecos, 0, 8, e2, },
{ "full name", p_gecos, 0, 9, e2, ""},
{ "office phone", p_gecos, 0, 12, e2, ""},
{ "home phone", p_gecos, 0, 10, e2, ""},
{ "location", p_gecos, 0, 8, e2, ""},
{ "home directory", p_hdir, 1, 14, e1, },
{ "shell", p_shell, 0, 5, e1, },
{ NULL, 0, },