Browse Source

asprintf; millert ok

OPENBSD_3_4
deraadt 22 years ago
parent
commit
8ccc7922d7
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      src/lib/libutil/passwd.c

+ 4
- 5
src/lib/libutil/passwd.c View File

@ -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;
}


Loading…
Cancel
Save