* src/create.c (split_long_name): Fix prefix length
calculation.
(write_ustar_long_name): Improve ustar mode compatibility
with the Sun version.
- if (length > PREFIX_FIELD_SIZE)
+ if (length > PREFIX_FIELD_SIZE + 1)
length = PREFIX_FIELD_SIZE + 1;
length = PREFIX_FIELD_SIZE + 1;
+ else if (ISSLASH (name[length - 1]))
+ length--;
for (i = length - 1; i > 0; i--)
if (ISSLASH (name[i]))
break;
for (i = length - 1; i > 0; i--)
if (ISSLASH (name[i]))
break;
write_ustar_long_name (const char *name)
{
size_t length = strlen (name);
write_ustar_long_name (const char *name)
{
size_t length = strlen (name);
if (length > PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1)
{
ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
if (length > PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1)
{
ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
}
i = split_long_name (name, length);
}
i = split_long_name (name, length);
- if (i == 0 || length - i - 1 > NAME_FIELD_SIZE)
+ if (i == 0 || (nlen = length - i - 1) > NAME_FIELD_SIZE || nlen == 0)
{
ERROR ((0, 0,
_("%s: file name is too long (cannot be split); not dumped"),
{
ERROR ((0, 0,
_("%s: file name is too long (cannot be split); not dumped"),