about summary refs log tree commit diff
path: root/sunrpc/svc.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-02-28 15:22:13 +0100
committerFlorian Weimer <fweimer@redhat.com>2017-02-28 15:36:16 +0100
commit37fb019cb02656d0ce0b8d40d56fe8c42f0d1658 (patch)
tree08df71d901ec8907c0b560c49d80e875cfcb8608 /sunrpc/svc.c
parentb31737bdf94a1d9eb4108d10c4d38241b6fe788b (diff)
downloadglibc-37fb019cb02656d0ce0b8d40d56fe8c42f0d1658.tar.gz
glibc-37fb019cb02656d0ce0b8d40d56fe8c42f0d1658.tar.xz
glibc-37fb019cb02656d0ce0b8d40d56fe8c42f0d1658.zip
sunrpc: Do not unregister services if not registered [BZ #5010]
The change in commit 718946816cf60374f9d8f674d3ed649fdb33205a
has no effect because of two bugs which cancel each other out:
The svc_is_mapped condition is inverted, and svc_is_mapped
always returns false because the check is performed after
the service has already been unregistered.  As a result,
pmap_unset is called unconditionally, as before.
Diffstat (limited to 'sunrpc/svc.c')
-rw-r--r--sunrpc/svc.c14
1 files changed, 2 insertions, 12 deletions
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 0aef2b5f95..03f963018c 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -182,17 +182,6 @@ done:
   return s;
 }
 
-
-static bool_t
-svc_is_mapped (rpcprog_t prog, rpcvers_t vers)
-{
-  struct svc_callout *prev;
-  register struct svc_callout *s;
-  s = svc_find (prog, vers, &prev);
-  return s!= NULL_SVC && s->sc_mapped;
-}
-
-
 /* Add a service program to the callout list.
    The dispatch routine will be called when a rpc request for this
    program number comes in. */
@@ -248,6 +237,7 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers)
 
   if ((s = svc_find (prog, vers, &prev)) == NULL_SVC)
     return;
+  bool is_mapped = s->sc_mapped;
 
   if (prev == NULL_SVC)
     svc_head = s->sc_next;
@@ -257,7 +247,7 @@ svc_unregister (rpcprog_t prog, rpcvers_t vers)
   s->sc_next = NULL_SVC;
   mem_free ((char *) s, (u_int) sizeof (struct svc_callout));
   /* now unregister the information with the local binder service */
-  if (! svc_is_mapped (prog, vers))
+  if (is_mapped)
     pmap_unset (prog, vers);
 }
 libc_hidden_nolink_sunrpc (svc_unregister, GLIBC_2_0)