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