X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=lib%2Fpath-concat.c;h=d6dafc939850ad1467f2612f88649364313e642a;hb=985743b6a147e8c83d1bdd9e6dd87e465a25869b;hp=8c4bbb4e8b2e73c3a5b5d16df79ffea1dc1fbda2;hpb=eeedc1da55cffb2f03fe8eaaad1a595ed698d668;p=gnulib.git diff --git a/lib/path-concat.c b/lib/path-concat.c index 8c4bbb4e8..d6dafc939 100644 --- a/lib/path-concat.c +++ b/lib/path-concat.c @@ -86,10 +86,13 @@ path_concat (const char *dir, const char *base, char **base_in_result) p = mempcpy (p_concat, dir, dir_len); - if (ISSLASH (*(p - 1)) && ISSLASH(*base)) - --p; - else if (!ISSLASH (*(p - 1)) && !ISSLASH(*base)) - *p++ = DIRECTORY_SEPARATOR; + if (dir_len > 0) + { + if (ISSLASH (*(p - 1)) && ISSLASH(*base)) + --p; + else if (!ISSLASH (*(p - 1)) && !ISSLASH(*base)) + *p++ = DIRECTORY_SEPARATOR; + } if (base_in_result) *base_in_result = p;