correct use of howmany() for fd_set. commented by deraadt

This commit is contained in:
itojun 2001-01-12 18:50:57 +00:00
parent 606c47534d
commit 3a616a4855
2 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: ping.c,v 1.57 2000/10/10 20:24:53 is Exp $ */
/* $NetBSD: ping.c,v 1.58 2001/01/12 18:50:57 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@ -62,7 +62,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ping.c,v 1.57 2000/10/10 20:24:53 is Exp $");
__RCSID("$NetBSD: ping.c,v 1.58 2001/01/12 18:50:57 itojun Exp $");
#endif
#include <stdio.h>
@ -678,7 +678,7 @@ doit(void)
d_last = 365*24*60*60;
}
nfdmask = howmany(s + 1, NFDBITS);
nfdmask = howmany(s + 1, NFDBITS) * sizeof(fd_mask);
if ((fdmaskp = malloc(nfdmask)) == NULL)
err(1, "malloc");
memset(fdmaskp, 0, nfdmask);

View File

@ -1,4 +1,4 @@
/* $NetBSD: ping6.c,v 1.28 2000/12/31 05:04:15 itojun Exp $ */
/* $NetBSD: ping6.c,v 1.29 2001/01/12 18:50:58 itojun Exp $ */
/* $KAME: ping6.c,v 1.109 2000/12/27 11:32:37 itojun Exp $ */
/*
@ -81,7 +81,7 @@ static char sccsid[] = "@(#)ping.c 8.1 (Berkeley) 6/5/93";
#else
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: ping6.c,v 1.28 2000/12/31 05:04:15 itojun Exp $");
__RCSID("$NetBSD: ping6.c,v 1.29 2001/01/12 18:50:58 itojun Exp $");
#endif
#endif
@ -976,7 +976,7 @@ main(argc, argv)
(void)setitimer(ITIMER_REAL, &itimer, NULL);
}
fdmasks = howmany(s+1, NFDBITS);
fdmasks = howmany(s + 1, NFDBITS) * sizeof(fd_mask);
if ((fdmaskp = malloc(fdmasks)) == NULL)
err(1, "malloc");