diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-30 21:10:28 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-30 21:10:28 +0000 |
commit | 548b158770d05fce542d6ab654a1d369baff8f9d (patch) | |
tree | 57604c16831c5795dedc5544e02aadb22ec917e1 | |
parent | 84c6eb065a701f81e8598b52ffb5bd4836107ee5 (diff) |
more asprintf; millert ok
-rw-r--r-- | lib/libutil/passwd.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c index 38ae21e1bfd..75d082c6325 100644 --- a/lib/libutil/passwd.c +++ b/lib/libutil/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.37 2003/03/30 20:57:59 deraadt Exp $ */ +/* $OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 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.37 2003/03/30 20:57:59 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: passwd.c,v 1.38 2003/03/30 21:10:27 deraadt Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -394,10 +394,8 @@ pw_edit(notsetuid, filename) if ((editor = getenv("EDITOR")) == NULL) editor = _PATH_VI; - p = malloc(strlen(editor) + 1 + strlen(filename) + 1); - if (p == NULL) + if (asprintf(&p, "%s %s", editor, filename) == -1) return; - sprintf(p, "%s %s", editor, filename); argp[2] = p; switch (editpid = vfork()) { |