Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 2015 15:20:08 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292605 - head/usr.sbin/cron/cron
Message-ID:  <201512221520.tBMFK87S049253@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Tue Dec 22 15:20:08 2015
New Revision: 292605
URL: https://svnweb.freebsd.org/changeset/base/292605

Log:
  crontab: replace malloc + bzero with calloc
  
  Obtained from:	OpenBSD (Rev 1.20)

Modified:
  head/usr.sbin/cron/cron/popen.c

Modified: head/usr.sbin/cron/cron/popen.c
==============================================================================
--- head/usr.sbin/cron/cron/popen.c	Tue Dec 22 15:03:45 2015	(r292604)
+++ head/usr.sbin/cron/cron/popen.c	Tue Dec 22 15:20:08 2015	(r292605)
@@ -82,9 +82,8 @@ cron_popen(program, type, e)
 	if (!pids) {
 		if ((fds = getdtablesize()) <= 0)
 			return(NULL);
-		if (!(pids = (PID_T *)malloc((u_int)(fds * sizeof(PID_T)))))
+		if (!(pids = calloc(fds, sizeof(PID_T))))
 			return(NULL);
-		bzero((char *)pids, fds * sizeof(PID_T));
 	}
 	if (pipe(pdes) < 0)
 		return(NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201512221520.tBMFK87S049253>