change the minimum requrired value for sysroot_len to 1 in case of identifying sysroot=/
authorBogon Kim <bogon82.kim@samsung.com>
Thu, 14 Nov 2013 00:55:13 +0000 (09:55 +0900)
committerJunfeng Dong <junfeng.dong@intel.com>
Mon, 18 Nov 2013 06:23:01 +0000 (14:23 +0800)
Change-Id: Ic9107e1e7ff39def1535b11a4bf1b7f3d7d8213a
Signed-off-by: Bogon Kim <bogon82.kim@samsung.com>
gcc/gcc.c
gcc/incpath.c

index fea7394..43da7ae 100644 (file)
--- a/gcc/gcc.c
+++ b/gcc/gcc.c
@@ -2544,7 +2544,7 @@ add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
       char *sysroot_no_trailing_dir_separator = xstrdup (target_system_root);
       size_t sysroot_len = strlen (target_system_root);
 
-      if (sysroot_len > 0
+      if (sysroot_len > 1
          && target_system_root[sysroot_len - 1] == DIR_SEPARATOR)
        sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0';
 
index 018da98..fbbe397 100644 (file)
@@ -179,7 +179,7 @@ add_standard_paths (const char *sysroot, const char *iprefix,
              char *sysroot_no_trailing_dir_separator = xstrdup (sysroot);
              size_t sysroot_len = strlen (sysroot);
 
-             if (sysroot_len > 0 && sysroot[sysroot_len - 1] == DIR_SEPARATOR)
+             if (sysroot_len > 1 && sysroot[sysroot_len - 1] == DIR_SEPARATOR)
                sysroot_no_trailing_dir_separator[sysroot_len - 1] = '\0';
              str = concat (sysroot_no_trailing_dir_separator, p->fname, NULL);
              free (sysroot_no_trailing_dir_separator);