c6d234
commit 1c36e1e6a5b9b6f9ad1c67f5d43383afb4d80339
c6d234
Author: Dmitry V. Levin <ldv@altlinux.org>
c6d234
Date:   Wed Dec 20 11:27:51 2017 +0000
c6d234
c6d234
    elf: remove redundant code from is_dst
c6d234
    
c6d234
    is_dst is called either by _dl_dst_count or by _dl_dst_substitute.
c6d234
    _dl_dst_count is called by DL_DST_COUNT only.
c6d234
    DL_DST_COUNT is called either by expand_dst with is_path == 0
c6d234
    or by expand_dynamic_string_token.
c6d234
    _dl_dst_substitute is called either from expand_dst with is_path == 0
c6d234
    or from expand_dynamic_string_token.
c6d234
    The latter function is called either from _dl_map_object with is_path == 0
c6d234
    or from fillin_rpath with is_path == 1 and name containing no ':'.
c6d234
    
c6d234
    In any case (is_path && name[i] == ':') is always false and all code
c6d234
    depending on it can be safely removed.
c6d234
    
c6d234
    * elf/dl-load.c (is_dst): Remove checks that is_path is set and name
c6d234
    contains ':', and all code depending on these checks.
c6d234
c6d234
Index: glibc-2.17-c758a686/elf/dl-load.c
c6d234
===================================================================
c6d234
--- glibc-2.17-c758a686.orig/elf/dl-load.c
c6d234
+++ glibc-2.17-c758a686/elf/dl-load.c
c6d234
@@ -258,14 +258,12 @@ is_dst (const char *start, const char *n
c6d234
       /* Skip over closing curly brace and adjust for the --name.  */
c6d234
       len += 2;
c6d234
     }
c6d234
-  else if (name[len] != '\0' && name[len] != '/'
c6d234
-	   && (!is_path || name[len] != ':'))
c6d234
+  else if (name[len] != '\0' && name[len] != '/')
c6d234
     return 0;
c6d234
 
c6d234
   if (__builtin_expect (secure, 0)
c6d234
-      && ((name[len] != '\0' && name[len] != '/'
c6d234
-	   && (!is_path || name[len] != ':'))
c6d234
-	  || (name != start + 1 && (!is_path || name[-2] != ':'))))
c6d234
+      && ((name[len] != '\0' && name[len] != '/')
c6d234
+	  || (name != start + 1)))
c6d234
     return 0;
c6d234
 
c6d234
   return len;