diff options
author | 1996-08-20 20:01:56 +0000 | |
---|---|---|
committer | 1996-08-20 20:01:56 +0000 | |
commit | ba7b2686b3b201b3c66cabf6fb8d8f29315496b1 (patch) | |
tree | 0c402c2c19be532f9cd1e60527406fc5662ad4c4 | |
parent | Makefile and script fixes. (diff) | |
download | wireguard-openbsd-ba7b2686b3b201b3c66cabf6fb8d8f29315496b1.tar.xz wireguard-openbsd-ba7b2686b3b201b3c66cabf6fb8d8f29315496b1.zip |
deal with unintializated __svc_fdset
-rw-r--r-- | lib/libc/rpc/svc_run.c | 19 |
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); |