summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordm <dm@cvs.openbsd.org>1997-06-04 03:18:42 +0000
committerdm <dm@cvs.openbsd.org>1997-06-04 03:18:42 +0000
commit2dbf463b1fa036f3f7c08d3efd19a69562b54936 (patch)
tree4e9a25810c913bd6431c2be7e35e3343b3b1e2ad
parentc35a45090a123fc8a5e09fbf7a3a10a0a25f693b (diff)
use bzero instead of FD_ZERO
-rw-r--r--lib/libc/net/rcmd.c8
-rw-r--r--lib/libc/net/res_send.c9
2 files changed, 8 insertions, 9 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index 468c93eb637..00a554a0a2b 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.22 1997/06/03 22:43:42 deraadt Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.23 1997/06/04 03:18:40 dm Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -163,11 +163,11 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char num[8];
int s2 = rresvport(&lport), s3;
int len = sizeof(from);
+ int fdssize = howmany(MAX(s, s2)+1, NFDBITS) * sizeof(fd_mask);
if (s2 < 0)
goto bad;
- readsp = (fd_set *)malloc(howmany(MAX(s, s2)+1, NFDBITS) *
- sizeof(fd_mask));
+ readsp = (fd_set *)malloc(fdssize);
if (readsp == NULL)
goto bad;
listen(s2, 1);
@@ -180,7 +180,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
goto bad;
}
again:
- FD_ZERO(readsp);
+ bzero(readsp,fdssize);
FD_SET(s, readsp);
FD_SET(s2, readsp);
errno = 0;
diff --git a/lib/libc/net/res_send.c b/lib/libc/net/res_send.c
index 0456dc0cf14..b89398aab3f 100644
--- a/lib/libc/net/res_send.c
+++ b/lib/libc/net/res_send.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: res_send.c,v 1.6 1997/06/03 22:43:43 deraadt Exp $ */
+/* $OpenBSD: res_send.c,v 1.7 1997/06/04 03:18:41 dm Exp $ */
/*
* ++Copyright++ 1985, 1989, 1993
@@ -60,7 +60,7 @@
static char sccsid[] = "@(#)res_send.c 8.1 (Berkeley) 6/4/93";
static char rcsid[] = "$From: res_send.c,v 8.12 1996/10/08 04:51:06 vixie Exp $";
#else
-static char rcsid[] = "$OpenBSD: res_send.c,v 1.6 1997/06/03 22:43:43 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: res_send.c,v 1.7 1997/06/04 03:18:41 dm Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -595,13 +595,12 @@ read_len:
timeout.tv_sec = 1;
timeout.tv_usec = 0;
wait:
- dsmaskp = (fd_set *)malloc(howmany(s+1, NFDBITS) *
- sizeof(fd_mask));
+ dsmaskp = (fd_set *)calloc(howmany(s+1, NFDBITS),
+ sizeof(fd_mask));
if (dsmaskp == NULL) {
res_close();
goto next_ns;
}
- FD_ZERO(dsmaskp);
FD_SET(s, dsmaskp);
n = select(s+1, dsmaskp, (fd_set *)NULL,
(fd_set *)NULL, &timeout);