Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sbin correct use of howmany() for fd_set. commented by deraadt



details:   https://anonhg.NetBSD.org/src/rev/f36dcc0985f9
branches:  trunk
changeset: 502148:f36dcc0985f9
user:      itojun <itojun%NetBSD.org@localhost>
date:      Fri Jan 12 18:50:57 2001 +0000

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

diffstat:

 sbin/ping/ping.c   |  6 +++---
 sbin/ping6/ping6.c |  6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (54 lines):

diff -r a560de68b195 -r f36dcc0985f9 sbin/ping/ping.c
--- a/sbin/ping/ping.c  Fri Jan 12 17:48:37 2001 +0000
+++ b/sbin/ping/ping.c  Fri Jan 12 18:50:57 2001 +0000
@@ -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 @@
                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);
diff -r a560de68b195 -r f36dcc0985f9 sbin/ping6/ping6.c
--- a/sbin/ping6/ping6.c        Fri Jan 12 17:48:37 2001 +0000
+++ b/sbin/ping6/ping6.c        Fri Jan 12 18:50:57 2001 +0000
@@ -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 @@
 #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 @@
                (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");
 



Home | Main Index | Thread Index | Old Index