about summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index 931e22625c..d1ccfd4ada 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -396,7 +396,17 @@ _dl_open (const char *file, int mode, const void *caller)
       /* Remove the object from memory.  It may be in an inconsistent
 	 state if relocation failed, for example.  */
       if (args.map)
-	_dl_close (args.map);
+	{
+	  int i;
+
+	  /* Increment open counters for all objects which did not get
+	     correctly loaded.  */
+	  for (i = 0; i < args.map->l_searchlist.r_nlist; ++i)
+	    if (args.map->l_searchlist.r_list[i]->l_opencount == 0)
+	      args.map->l_searchlist.r_list[i]->l_opencount = 1;
+
+	  _dl_close (args.map);
+	}
 
       /* Make a local copy of the error string so that we can release the
 	 memory allocated for it.  */