diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/chpass/field.c | 8 | ||||
-rw-r--r-- | usr.bin/chpass/pw_yp.c | 10 |
2 files changed, 7 insertions, 11 deletions
diff --git a/usr.bin/chpass/field.c b/usr.bin/chpass/field.c index 3e0629e622c..50c2942b93e 100644 --- a/usr.bin/chpass/field.c +++ b/usr.bin/chpass/field.c @@ -1,4 +1,4 @@ -/* $OpenBSD: field.c,v 1.8 2006/03/30 21:09:58 robert Exp $ */ +/* $OpenBSD: field.c,v 1.9 2006/03/31 00:29:13 deraadt Exp $ */ /* $NetBSD: field.c,v 1.3 1995/03/26 04:55:28 glass Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)field.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: field.c,v 1.8 2006/03/30 21:09:58 robert Exp $"; +static char rcsid[] = "$OpenBSD: field.c,v 1.9 2006/03/31 00:29:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -57,8 +57,6 @@ static char rcsid[] = "$OpenBSD: field.c,v 1.8 2006/03/30 21:09:58 robert Exp $" int p_login(char *p, struct passwd *pw, ENTRY *ep) { - struct passwd *tpw; - if (!*p) { warnx("empty login field"); return (1); @@ -68,7 +66,7 @@ p_login(char *p, struct passwd *pw, ENTRY *ep) return (1); } /* XXX - what about truncated names? */ - if (strcmp(pw->pw_name, p) != 0 && (tpw = getpwnam(p)) != NULL) { + if (strcmp(pw->pw_name, p) != 0 && getpwnam(p) != NULL) { warnx("login %s already exists", p); return (1); } diff --git a/usr.bin/chpass/pw_yp.c b/usr.bin/chpass/pw_yp.c index e47fc549154..219cf830adc 100644 --- a/usr.bin/chpass/pw_yp.c +++ b/usr.bin/chpass/pw_yp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pw_yp.c,v 1.20 2005/04/11 07:13:03 deraadt Exp $ */ +/* $OpenBSD: pw_yp.c,v 1.21 2006/03/31 00:29:13 deraadt Exp $ */ /* $NetBSD: pw_yp.c,v 1.5 1995/03/26 04:55:33 glass Exp $ */ /* @@ -33,7 +33,7 @@ #if 0 static char sccsid[] = "@(#)pw_yp.c 1.0 2/2/93"; #else -static char rcsid[] = "$OpenBSD: pw_yp.c,v 1.20 2005/04/11 07:13:03 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: pw_yp.c,v 1.21 2006/03/31 00:29:13 deraadt Exp $"; #endif #endif /* not lint */ @@ -243,12 +243,11 @@ ypgetpwnam(char *nam) break; default: return (NULL); - break; } val[vallen] = '\0'; if (__yplin) free(__yplin); - if (!(__yplin = (char *)malloc(vallen + 1))) + if (!(__yplin = malloc(vallen + 1))) err(1, NULL); strlcpy(__yplin, val, vallen + 1); free(val); @@ -277,12 +276,11 @@ ypgetpwuid(uid_t uid) break; default: return (NULL); - break; } val[vallen] = '\0'; if (__yplin) free(__yplin); - if (!(__yplin = (char *)malloc(vallen + 1))) + if (!(__yplin = malloc(vallen + 1))) err(1, NULL); strlcpy(__yplin, val, vallen + 1); free(val); |