about summary refs log tree commit diff
path: root/elf/dl-close.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-close.c')
-rw-r--r--elf/dl-close.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/elf/dl-close.c b/elf/dl-close.c
index ec563ed8d0..99d52d02e2 100644
--- a/elf/dl-close.c
+++ b/elf/dl-close.c
@@ -48,6 +48,11 @@ _dl_close (void *_map)
   unsigned int nrellist;
   unsigned int i;
 
+  /* First see whether we can remove the object at all.  */
+  if (map->l_flags_1 & DF_1_NODELETE)
+    /* Nope.  Do nothing.  */
+    return;
+
   if (map->l_opencount == 0)
     _dl_signal_error (0, map->l_name, N_("shared object not open"));
 
@@ -112,7 +117,8 @@ _dl_close (void *_map)
      points to, the 0th elt being MAP itself.  Decrement the reference
      counts on all the objects MAP depends on.  */
   for (i = 0; i < nsearchlist; ++i)
-    --list[i]->l_opencount;
+    if (! (list[i]->l_flags_1 & DF_1_NODELETE))
+      --list[i]->l_opencount;
 
   /* Check each element of the search list to see if all references to
      it are gone.  */