Author: pfg Date: Mon Apr 18 15:01:49 2016 New Revision: 298211 URL: https://svnweb.freebsd.org/changeset/base/298211
Log: ftpd: replace malloc + memset 0 with calloc. It is faster and usually safer. Use NULL instead of zero for the pointer. Modified: head/libexec/ftpd/popen.c Modified: head/libexec/ftpd/popen.c ============================================================================== --- head/libexec/ftpd/popen.c Mon Apr 18 14:45:56 2016 (r298210) +++ head/libexec/ftpd/popen.c Mon Apr 18 15:01:49 2016 (r298211) @@ -81,9 +81,8 @@ ftpd_popen(char *program, char *type) if (!pids) { if ((fds = getdtablesize()) <= 0) return (NULL); - if ((pids = malloc(fds * sizeof(int))) == NULL) + if ((pids = calloc(fds, sizeof(int))) == NULL) return (NULL); - memset(pids, 0, fds * sizeof(int)); } if (pipe(pdes) < 0) return (NULL); @@ -185,7 +184,7 @@ ftpd_pclose(FILE *iop) * pclose returns -1 if stream is not associated with a * `popened' command, or, if already `pclosed'. */ - if (pids == 0 || pids[fdes = fileno(iop)] == 0) + if (pids == NULL || pids[fdes = fileno(iop)] == 0) return (-1); (void)fclose(iop); omask = sigblock(sigmask(SIGINT)|sigmask(SIGQUIT)|sigmask(SIGHUP)); _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"