archelp: Fix handling of dot and dotdot at the end of the name.

Fixes cpio_test and tar_test.
This commit is contained in:
Vladimir Serbinenko 2015-07-23 19:01:00 +02:00
parent ca73ae446c
commit f34a422081

View file

@ -34,12 +34,12 @@ canonicalize (char *name)
iptr++;
if (iptr[0] == '.' && (iptr[1] == '/' || iptr[1] == 0))
{
iptr += 2;
iptr++;
continue;
}
if (iptr[0] == '.' && iptr[1] == '.' && (iptr[2] == '/' || iptr[2] == 0))
{
iptr += 3;
iptr += 2;
if (optr == name)
continue;
for (optr -= 2; optr >= name && *optr != '/'; optr--);