summaryrefslogtreecommitdiff
path: root/libexec/ftpd/popen.c
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2006-04-02 21:38:58 +0000
committerDamien Miller <djm@cvs.openbsd.org>2006-04-02 21:38:58 +0000
commit5b14fea36497511e6428b2c588513d92bc92cb90 (patch)
tree0b66759932d131cfb42148e0672334d215e6b99f /libexec/ftpd/popen.c
parentba37f6b6fd488dbe7dd7be429e8b7a994a783155 (diff)
malloc(x * y) -> calloc(x, y) from adobriyan AT gmail.com, with tweaks
suggested by kjell@; ok otto@ pat@ millert@ jaredy@
Diffstat (limited to 'libexec/ftpd/popen.c')
-rw-r--r--libexec/ftpd/popen.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
index 4b57d570a78..c47918d7f16 100644
--- a/libexec/ftpd/popen.c
+++ b/libexec/ftpd/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.20 2003/12/10 22:57:12 deraadt Exp $ */
+/* $OpenBSD: popen.c,v 1.21 2006/04/02 21:38:56 djm Exp $ */
/* $NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $ */
/*
@@ -39,7 +39,7 @@
static const char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#else
static const char rcsid[] =
- "$OpenBSD: popen.c,v 1.20 2003/12/10 22:57:12 deraadt Exp $";
+ "$OpenBSD: popen.c,v 1.21 2006/04/02 21:38:56 djm Exp $";
#endif
#endif /* not lint */
@@ -84,9 +84,8 @@ ftpd_popen(char *program, char *type)
if (!pids) {
if ((fds = getdtablesize()) <= 0)
return (NULL);
- if ((pids = (pid_t *)malloc((u_int)(fds * sizeof(pid_t)))) == NULL)
+ if ((pids = calloc(fds, sizeof(pid_t))) == NULL)
return (NULL);
- memset(pids, 0, fds * sizeof(pid_t));
}
if (pipe(pdes) < 0)
return (NULL);