From d932e1904adfcf321f402c75b506c23119d044af Mon Sep 17 00:00:00 2001 From: Bogon Kim Date: Thu, 14 Nov 2013 09:55:13 +0900 Subject: [PATCH] change the minimum requrired value for sysroot_len to 1 in case of identifying sysroot=/ Change-Id: Ic9107e1e7ff39def1535b11a4bf1b7f3d7d8213a Signed-off-by: Bogon Kim --- gcc/gcc.c | 2 +- gcc/incpath.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gcc/gcc.c b/gcc/gcc.c index fea7394..43da7ae 100644 --- 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'; diff --git a/gcc/incpath.c b/gcc/incpath.c index 018da98..fbbe397 100644 --- a/gcc/incpath.c +++ b/gcc/incpath.c @@ -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); -- 2.7.4