* Copyright (C) 1995, 1996, Olaf Kirch <okir@monad.swb.de>
*/
-#include "config.h"
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <rpc/rpc.h>
{
struct rpc_dentry *dent;
- if (rqstp->rq_vers > nvers) {
+ if (((int)rqstp->rq_vers) > nvers) {
svcerr_progvers(transp, 1, nvers);
return;
}
return;
}
+ if (dtable->nproc <= rqstp->rq_proc) {
+ svcerr_noproc(transp);
+ return;
+ }
+
dent = dtable->entries + rqstp->rq_proc;
if (dent->func == NULL) {
exit (2);
}
}
-
-#if 0
-/*
- * This is our replacement for svc_run. It turns off some signals while
- * executing the server procedures to avoid nasty race conditions.
- */
-void
-rpc_svcrun(fd_set *morefds, void (*func)(int fd))
-{
- sigset_t block, current;
- fd_set readfds;
-
- for (;;) {
- readfds = svc_fdset;
- if (morefds) {
- int i;
-
- /* most efficient */
- for (i = 0; i < FD_SETSIZE; i++)
- if (FD_ISSET(i, morefds))
- FD_SET(i, &readfs);
- }
- switch (select(FD_SETSIZE, &readfds, NULL, NULL, NULL)) {
- case -1:
- if (errno == EINTR)
- continue;
- xlog(L_ERROR, "svc_run: - select failed");
- break;
- case 0:
- continue;
- default:
- if (morefds) {
- int i;
-
- /* most efficient */
- for (i = 0; i < FD_SETSIZE; i++)
- if (FD_ISSET(i, morefds) &&
- FD_ISSET(i, &readfds))
- func(i);
- }
- sigemptyset(&block);
- sigaddset(&block, SIGALRM);
- sigaddset(&block, SIGVTALRM);
- sigaddset(&block, SIGIO);
- sigprocmask(SIG_BLOCK, &block, ¤t);
- svc_getreqset(&readfds);
- sigprocmask(SIG_SETMASK, ¤t, NULL);
- }
- }
-}
-#endif