X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Fnames.c;h=a19afd7a20c80571ddfc440d0f4a98485f2879a2;hb=ebeb3d4f3058b7bbb92e7ea797cf938ec03ee2ed;hp=66648a08810460579849f18d80331b233edca67a;hpb=052118a907a138fc6d9189470ed05a9eb32f8fe9;p=chaz%2Ftar diff --git a/src/names.c b/src/names.c index 66648a0..a19afd7 100644 --- a/src/names.c +++ b/src/names.c @@ -1024,10 +1024,13 @@ safer_name_suffix (char const *file_name, bool link_target) for (p = file_name + prefix_len; *p; ) { - if (p[0] == '.' && p[1] == '.' && (ISSLASH (p[2]) || !p[2])) - prefix_len = p + 2 - file_name; - else if (p[0] == '.' && ISSLASH (p[1])) - prefix_len = p + 1 - file_name; + if (p[0] == '.') + { + if (p[1] == '.' && (ISSLASH (p[2]) || !p[2])) + prefix_len = p + 2 - file_name; + else if (ISSLASH (p[1])) + prefix_len = p + 1 - file_name; + } do { @@ -1073,7 +1076,7 @@ safer_name_suffix (char const *file_name, bool link_target) WARN ((0, 0, _(diagnostic[link_target]))); } - p = "."; + p = ISSLASH (file_name[strlen(file_name)-1]) ? "./" : "."; } return (char *) p;