From 04c8d9b90a16788a17fa495cbafe1f592f97a875 Mon Sep 17 00:00:00 2001 From: Neil Booth Date: Sun, 4 Mar 2001 15:10:46 +0000 Subject: [PATCH] * cppfiles.c (search_from): Special case the empty string. From-SVN: r40236 --- gcc/ChangeLog | 4 ++++ gcc/cppfiles.c | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 7a1772bb87e..029af4bc803 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2001-03-04 Neil Booth + + * cppfiles.c (search_from): Special case the empty string. + 2001-03-04 Neil Booth * cppfiles.c (_cpp_execute_include): Don't make a null-terminated diff --git a/gcc/cppfiles.c b/gcc/cppfiles.c index 0dfd9d0db66..7f15a8d24ca 100644 --- a/gcc/cppfiles.c +++ b/gcc/cppfiles.c @@ -804,7 +804,11 @@ search_from (pfile, inc) if (CPP_OPTION (pfile, ignore_srcdir)) return CPP_OPTION (pfile, quote_include); - dlen = basename (inc->name) - inc->name; + /* basename () on Solaris returns "." for an empty string. */ + dlen = 0; + if (inc->name[0] != '\0') + dlen = basename (inc->name) - inc->name; + if (dlen) { /* We don't guarantee NAME is null-terminated. This saves -- 2.30.2