summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/tr/str.c7
-rw-r--r--usr.sbin/cron/popen.c7
2 files changed, 6 insertions, 8 deletions
diff --git a/usr.bin/tr/str.c b/usr.bin/tr/str.c
index 4f9393815ce..1b36e39bf2d 100644
--- a/usr.bin/tr/str.c
+++ b/usr.bin/tr/str.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: str.c,v 1.9 2004/09/15 22:12:19 deraadt Exp $ */
+/* $OpenBSD: str.c,v 1.10 2006/04/03 01:31:11 djm Exp $ */
/* $NetBSD: str.c,v 1.7 1995/08/31 22:13:47 jtc Exp $ */
/*-
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)str.c 8.2 (Berkeley) 4/28/95";
#endif
-static char rcsid[] = "$OpenBSD: str.c,v 1.9 2004/09/15 22:12:19 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: str.c,v 1.10 2006/04/03 01:31:11 djm Exp $";
#endif /* not lint */
#include <sys/cdefs.h>
@@ -183,9 +183,8 @@ genclass(s)
sizeof(CLASS), sizeof(CLASS), c_class)) == NULL)
errx(1, "unknown class %s", s->str);
- if ((cp->set = p = malloc((NCHARS + 1) * sizeof(int))) == NULL)
+ if ((cp->set = p = calloc(NCHARS + 1, sizeof(int))) == NULL)
errx(1, "no memory for a class");
- bzero(p, (NCHARS + 1) * sizeof(int));
for (cnt = 0, func = cp->func; cnt < NCHARS; ++cnt)
if ((func)(cnt))
*p++ = cnt;
diff --git a/usr.sbin/cron/popen.c b/usr.sbin/cron/popen.c
index 62c3c569ff8..f02c2bb36ba 100644
--- a/usr.sbin/cron/popen.c
+++ b/usr.sbin/cron/popen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: popen.c,v 1.19 2003/06/02 04:39:45 millert Exp $ */
+/* $OpenBSD: popen.c,v 1.20 2006/04/03 01:31:11 djm Exp $ */
/*
* Copyright (c) 1988, 1993, 1994
@@ -41,7 +41,7 @@
#if 0
static const sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#else
-static const char rcsid[] = "$OpenBSD: popen.c,v 1.19 2003/06/02 04:39:45 millert Exp $";
+static const char rcsid[] = "$OpenBSD: popen.c,v 1.20 2006/04/03 01:31:11 djm Exp $";
#endif
#endif /* not lint */
@@ -72,9 +72,8 @@ cron_popen(char *program, char *type, struct passwd *pw) {
if (!pids) {
if ((fds = sysconf(_SC_OPEN_MAX)) <= 0)
return (NULL);
- if (!(pids = (PID_T *)malloc((size_t)(fds * sizeof(PID_T)))))
+ if (!(pids = calloc(fds, sizeof(PID_T))))
return (NULL);
- bzero(pids, fds * sizeof(PID_T));
}
if (pipe(pdes) < 0)
return (NULL);