aboutsummaryrefslogtreecommitdiff
path: root/gcc/prefix.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/prefix.c')
-rw-r--r--gcc/prefix.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/prefix.c b/gcc/prefix.c
index c659c28..e37f69b 100644
--- a/gcc/prefix.c
+++ b/gcc/prefix.c
@@ -279,8 +279,9 @@ translate_name (name)
if (prefix == 0)
prefix = PREFIX;
- /* Remove any trailing directory separator from what we got. */
- if (IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
+ /* Remove any trailing directory separator from what we got. First check
+ for an empty prefix. */
+ if (prefix[0] && IS_DIR_SEPARATOR (prefix[strlen (prefix) - 1]))
{
char * temp = xstrdup (prefix);
temp[strlen (temp) - 1] = 0;