]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
elf: remove redundant code from is_dst
authorDmitry V. Levin <ldv@altlinux.org>
Wed, 20 Dec 2017 11:27:51 +0000 (11:27 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Wed, 27 Dec 2017 22:12:51 +0000 (22:12 +0000)
is_dst is called either by _dl_dst_count or by _dl_dst_substitute.
_dl_dst_count is called by DL_DST_COUNT only.
DL_DST_COUNT is called either by expand_dst with is_path == 0
or by expand_dynamic_string_token.
_dl_dst_substitute is called either from expand_dst with is_path == 0
or from expand_dynamic_string_token.
The latter function is called either from _dl_map_object with is_path == 0
or from fillin_rpath with is_path == 1 and name containing no ':'.

In any case (is_path && name[i] == ':') is always false and all code
depending on it can be safely removed.

* elf/dl-load.c (is_dst): Remove checks that is_path is set and name
contains ':', and all code depending on these checks.

ChangeLog
elf/dl-load.c

index 297dd703c50aea7832899a5704b6bca59c0ddafa..97aeed5db550dfec35b9dd9dc7e4bedcb343258b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2017-12-27  Dmitry V. Levin  <ldv@altlinux.org>
 
+       * elf/dl-load.c (is_dst): Remove checks that is_path is set and name
+       contains ':'.
+
        * elf/dl-load.c (_dl_dst_substitute): Remove checks that is_path
        is set and name contains ':', and all code depending on these checks.
 
index a60277d311f5b9959089c1f739910e2aa400585e..87dfdf8a15a19db58f72f2ad898ff7e6ddf52d7d 100644 (file)
@@ -206,14 +206,12 @@ is_dst (const char *start, const char *name, const char *str,
       /* Skip over closing curly brace and adjust for the --name.  */
       len += 2;
     }
-  else if (name[len] != '\0' && name[len] != '/'
-          && (!is_path || name[len] != ':'))
+  else if (name[len] != '\0' && name[len] != '/')
     return 0;
 
   if (__glibc_unlikely (secure)
-      && ((name[len] != '\0' && name[len] != '/'
-          && (!is_path || name[len] != ':'))
-         || (name != start + 1 && (!is_path || name[-2] != ':'))))
+      && ((name[len] != '\0' && name[len] != '/')
+         || (name != start + 1)))
     return 0;
 
   return len;