| 353 |
set_next_block_after (pointer); |
set_next_block_after (pointer); |
| 354 |
} |
} |
| 355 |
|
|
| 356 |
|
/* Copy at most LEN bytes from SRC to DST. Terminate with NUL unless |
| 357 |
|
SRC is LEN characters long */ |
| 358 |
|
static void |
| 359 |
|
tar_copy_str (char *dst, const char *src, size_t len) |
| 360 |
|
{ |
| 361 |
|
dst[len-1] = 0; |
| 362 |
|
strncpy (dst, src, len); |
| 363 |
|
} |
| 364 |
|
|
| 365 |
/* Write a "private" header */ |
/* Write a "private" header */ |
| 366 |
static union block * |
static union block * |
| 367 |
start_private_header (const char *name, size_t size) |
start_private_header (const char *name, size_t size) |
| 371 |
|
|
| 372 |
memset (header->buffer, 0, sizeof (union block)); |
memset (header->buffer, 0, sizeof (union block)); |
| 373 |
|
|
| 374 |
strncpy (header->header.name, name, NAME_FIELD_SIZE); |
tar_copy_str (header->header.name, name, NAME_FIELD_SIZE); |
|
header->header.name[NAME_FIELD_SIZE - 1] = '\0'; |
|
| 375 |
OFF_TO_CHARS (size, header->header.size); |
OFF_TO_CHARS (size, header->header.size); |
| 376 |
|
|
| 377 |
time (&t); |
time (&t); |
| 394 |
{ |
{ |
| 395 |
union block *header = find_next_block (); |
union block *header = find_next_block (); |
| 396 |
memset (header->buffer, 0, sizeof (union block)); |
memset (header->buffer, 0, sizeof (union block)); |
| 397 |
|
tar_copy_str (header->header.name, st->file_name, NAME_FIELD_SIZE); |
|
strncpy (header->header.name, st->file_name, NAME_FIELD_SIZE); |
|
|
header->header.name[NAME_FIELD_SIZE - 1] = '\0'; |
|
| 398 |
return header; |
return header; |
| 399 |
} |
} |
| 400 |
|
|
| 457 |
} |
} |
| 458 |
|
|
| 459 |
i = split_long_name (name, length); |
i = split_long_name (name, length); |
| 460 |
if (i == 0) |
if (i == 0 || length - i -1 > NAME_FIELD_SIZE) |
| 461 |
{ |
{ |
| 462 |
WARN ((0, 0, |
WARN ((0, 0, |
| 463 |
_("%s: file name is too long (cannot be split); not dumped"), |
_("%s: file name is too long (cannot be split); not dumped"), |
| 469 |
header = find_next_block (); |
header = find_next_block (); |
| 470 |
memset (header->buffer, 0, sizeof (header->buffer)); |
memset (header->buffer, 0, sizeof (header->buffer)); |
| 471 |
memcpy (header->header.prefix, name, i); |
memcpy (header->header.prefix, name, i); |
| 472 |
memcpy (header->header.name, name + i + 1, length - i); |
memcpy (header->header.name, name + i + 1, length - i - 1); |
| 473 |
|
|
| 474 |
return header; |
return header; |
| 475 |
} |
} |
| 576 |
static union block * |
static union block * |
| 577 |
write_header_name (struct tar_stat_info *st) |
write_header_name (struct tar_stat_info *st) |
| 578 |
{ |
{ |
| 579 |
if (NAME_FIELD_SIZE <= strlen (st->file_name)) |
if (NAME_FIELD_SIZE < strlen (st->file_name)) |
| 580 |
return write_long_name (st); |
return write_long_name (st); |
| 581 |
else |
else |
| 582 |
return write_short_name (st); |
return write_short_name (st); |
| 1091 |
return ((link1->dev ^ link2->dev) | (link1->ino ^ link2->ino)) == 0; |
return ((link1->dev ^ link2->dev) | (link1->ino ^ link2->ino)) == 0; |
| 1092 |
} |
} |
| 1093 |
|
|
|
/* Copy at most LEN bytes from SRC to DST. Terminate with NUL unless |
|
|
SRC is LEN characters long */ |
|
|
static void |
|
|
tar_copy_str (char *dst, const char *src, size_t len) |
|
|
{ |
|
|
dst[len-1] = 0; |
|
|
strncpy (dst, src, len); |
|
|
} |
|
|
|
|
| 1094 |
/* Table of all non-directories that we've written so far. Any time |
/* Table of all non-directories that we've written so far. Any time |
| 1095 |
we see another, we check the table and avoid dumping the data |
we see another, we check the table and avoid dumping the data |
| 1096 |
again if we've done it once already. */ |
again if we've done it once already. */ |
| 1744 |
|
|
| 1745 |
if (type != FIFOTYPE) |
if (type != FIFOTYPE) |
| 1746 |
{ |
{ |
| 1747 |
MAJOR_TO_CHARS (major (current_stat_info.stat.st_rdev), header->header.devmajor); |
MAJOR_TO_CHARS (major (current_stat_info.stat.st_rdev), |
| 1748 |
MINOR_TO_CHARS (minor (current_stat_info.stat.st_rdev), header->header.devminor); |
header->header.devmajor); |
| 1749 |
|
MINOR_TO_CHARS (minor (current_stat_info.stat.st_rdev), |
| 1750 |
|
header->header.devminor); |
| 1751 |
} |
} |
| 1752 |
|
|
| 1753 |
finish_header (header, block_ordinal); |
finish_header (header, block_ordinal); |