summaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-30 20:58:00 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-03-30 20:58:00 +0000
commitd0cb1325fcee2851986d29913723f539f13e54ae (patch)
treef580806893bf123cce3898482cc4bb38fc000696 /lib/libutil
parent65bffc3119e235ee616b2d7954d9c178cf425301 (diff)
asprintf; millert ok
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/passwd.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index fbd2d7308ea..38ae21e1bfd 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: passwd.c,v 1.36 2002/07/31 21:53:34 millert Exp $ */
+/* $OpenBSD: passwd.c,v 1.37 2003/03/30 20:57:59 deraadt Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$OpenBSD: passwd.c,v 1.36 2002/07/31 21:53:34 millert Exp $";
+static const char rcsid[] = "$OpenBSD: passwd.c,v 1.37 2003/03/30 20:57:59 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -143,10 +143,9 @@ pw_file(nm)
p++;
else
p = nm;
- new_nm = malloc(strlen(pw_dir) + strlen(p) + 2);
- if (!new_nm)
+
+ if (asprintf(&new_nm, "%s/%s", pw_dir, p) == -1)
return NULL;
- sprintf(new_nm, "%s/%s", pw_dir, p);
return new_nm;
}