summaryrefslogtreecommitdiff
path: root/lib/libc/rpc
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-20 20:01:57 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-20 20:01:57 +0000
commitb0ef9c9292df43c0b4b0006fc8adcfcb623f7324 (patch)
treec7d86b92a056c0c6b0cd619b76d10ea53fa2f05b /lib/libc/rpc
parent3f5ed913dc54eafb15b6f31b81c452ab784211a8 (diff)
deal with unintializated __svc_fdset
Diffstat (limited to 'lib/libc/rpc')
-rw-r--r--lib/libc/rpc/svc_run.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/lib/libc/rpc/svc_run.c b/lib/libc/rpc/svc_run.c
index 0098304a279..326d062c3a8 100644
--- a/lib/libc/rpc/svc_run.c
+++ b/lib/libc/rpc/svc_run.c
@@ -28,7 +28,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: svc_run.c,v 1.5 1996/08/19 08:31:55 tholo Exp $";
+static char *rcsid = "$OpenBSD: svc_run.c,v 1.6 1996/08/20 20:01:56 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -48,19 +48,26 @@ svc_run()
fd_set *fds;
for (;;) {
- fds = (fd_set *)malloc(howmany(__svc_fdsetsize, NBBY));
- memcpy(fds, __svc_fdset, howmany(__svc_fdsetsize, NBBY));
+ if (__svc_fdset) {
+ fds = (fd_set *)malloc(howmany(__svc_fdsetsize, NBBY));
+ memcpy(fds, __svc_fdset, howmany(__svc_fdsetsize,
+ NBBY));
+ } else
+ fds = NULL;
switch (select(svc_maxfd+1, fds, 0, 0, (struct timeval *)0)) {
case -1:
if (errno == EINTR) {
- free(fds);
+ if (fds)
+ free(fds);
continue;
}
perror("svc_run: - select failed");
- free(fds);
+ if (fds)
+ free(fds);
return;
case 0:
- free(fds);
+ if (fds)
+ free(fds);
continue;
default:
svc_getreqset2(fds, svc_maxfd+1);