about summary refs log tree commit diff
path: root/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/auth_unix.c2
-rw-r--r--sunrpc/clnt_raw.c2
-rw-r--r--sunrpc/pm_getmaps.c2
-rw-r--r--sunrpc/rpc_main.c2
-rw-r--r--sunrpc/svc_run.c38
5 files changed, 28 insertions, 18 deletions
diff --git a/sunrpc/auth_unix.c b/sunrpc/auth_unix.c
index 1740e58cdc..3eaf0a25ab 100644
--- a/sunrpc/auth_unix.c
+++ b/sunrpc/auth_unix.c
@@ -347,7 +347,7 @@ marshal_new_auth (AUTH *auth)
   INTUSE(xdrmem_create) (xdrs, au->au_marshed, MAX_AUTH_BYTES, XDR_ENCODE);
   if ((!INTUSE(xdr_opaque_auth) (xdrs, &(auth->ah_cred))) ||
       (!INTUSE(xdr_opaque_auth) (xdrs, &(auth->ah_verf))))
-    perror (_("auth_none.c - Fatal marshalling problem"));
+    perror (_("auth_unix.c: Fatal marshalling problem"));
   else
     au->au_mpos = XDR_GETPOS (xdrs);
 
diff --git a/sunrpc/clnt_raw.c b/sunrpc/clnt_raw.c
index 019f1bbae0..44ea03efb7 100644
--- a/sunrpc/clnt_raw.c
+++ b/sunrpc/clnt_raw.c
@@ -114,7 +114,7 @@ clntraw_create (u_long prog, u_long vers)
   INTUSE(xdrmem_create) (xdrs, clp->mashl_callmsg, MCALL_MSG_SIZE, XDR_ENCODE);
   if (!INTUSE(xdr_callhdr) (xdrs, &call_msg))
     {
-      perror (_ ("clnt_raw.c - Fatal header serialization error."));
+      perror (_ ("clnt_raw.c: fatal header serialization error"));
     }
   clp->mcnt = XDR_GETPOS (xdrs);
   XDR_DESTROY (xdrs);
diff --git a/sunrpc/pm_getmaps.c b/sunrpc/pm_getmaps.c
index 2a6876d9d8..b21e7ea85c 100644
--- a/sunrpc/pm_getmaps.c
+++ b/sunrpc/pm_getmaps.c
@@ -80,7 +80,7 @@ pmap_getmaps (struct sockaddr_in *address)
 		     (xdrproc_t)INTUSE(xdr_pmaplist), (caddr_t)&head,
 		     minutetimeout) != RPC_SUCCESS)
 	{
-	  clnt_perror (client, _("pmap_getmaps rpc problem"));
+	  clnt_perror (client, _("pmap_getmaps.c: rpc problem"));
 	}
       CLNT_DESTROY (client);
     }
diff --git a/sunrpc/rpc_main.c b/sunrpc/rpc_main.c
index 954657a7e4..bda432d3cd 100644
--- a/sunrpc/rpc_main.c
+++ b/sunrpc/rpc_main.c
@@ -457,7 +457,7 @@ check_nettype (const char *name, const char *list_to_check[])
 	  return 1;
 	}
     }
-  fprintf (stderr, _ ("illegal nettype :`%s'\n"), name);
+  fprintf (stderr, _ ("illegal nettype: `%s'\n"), name);
   return 0;
 }
 
diff --git a/sunrpc/svc_run.c b/sunrpc/svc_run.c
index d5e24dd0fc..f1f47fbf30 100644
--- a/sunrpc/svc_run.c
+++ b/sunrpc/svc_run.c
@@ -51,42 +51,52 @@ void
 svc_run (void)
 {
   int i;
+  struct pollfd *my_pollfd = NULL;
+  int last_max_pollfd = 0;
 
   for (;;)
     {
-      struct pollfd *my_pollfd;
+      int max_pollfd = svc_max_pollfd;
+      if (max_pollfd == 0 && svc_pollfd == NULL)
+	break;
 
-      if (svc_max_pollfd == 0 && svc_pollfd == NULL)
-	return;
-
-      my_pollfd = malloc (sizeof (struct pollfd) * svc_max_pollfd);
-      if (my_pollfd == NULL)
+      if (last_max_pollfd != max_pollfd)
 	{
-	  perror (_("svc_run: - out of memory"));
-	  return;
+	  struct pollfd *new_pollfd
+	    = realloc (my_pollfd, sizeof (struct pollfd) * max_pollfd);
+
+	  if (new_pollfd == NULL)
+	    {
+	      perror (_("svc_run: - out of memory"));
+	      break;
+	    }
+
+	  my_pollfd = new_pollfd;
+	  last_max_pollfd = max_pollfd;
 	}
 
-      for (i = 0; i < svc_max_pollfd; ++i)
+      for (i = 0; i < max_pollfd; ++i)
 	{
 	  my_pollfd[i].fd = svc_pollfd[i].fd;
 	  my_pollfd[i].events = svc_pollfd[i].events;
 	  my_pollfd[i].revents = 0;
 	}
 
-      switch (i = __poll (my_pollfd, svc_max_pollfd, -1))
+      switch (i = __poll (my_pollfd, max_pollfd, -1))
 	{
 	case -1:
-	  free (my_pollfd);
 	  if (errno == EINTR)
 	    continue;
 	  perror (_("svc_run: - poll failed"));
-	  return;
+	  break;
 	case 0:
-	  free (my_pollfd);
 	  continue;
 	default:
 	  INTUSE(svc_getreq_poll) (my_pollfd, i);
-	  free (my_pollfd);
+	  continue;
 	}
+      break;
     }
+
+  free (my_pollfd);
 }