X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=src%2Fcreate.c;h=910b4a239d684180b0ebeb4c4132495331737935;hb=91493ea9b62a24ab139eedd4c919e4fcda9750c3;hp=7b7e28f19aa54cebe68b41c4d643dc47c0190ff7;hpb=ce059f3cc8c9199553ecfe099d72419bfbf607da;p=chaz%2Ftar diff --git a/src/create.c b/src/create.c index 7b7e28f..910b4a2 100644 --- a/src/create.c +++ b/src/create.c @@ -402,6 +402,16 @@ write_long (const char *p, char type) set_next_block_after (header + (size - 1) / BLOCKSIZE); } +/* Write a long link name, depending on the current archive format */ +static void +write_long_link (struct tar_stat_info *st) +{ + if (archive_format == POSIX_FORMAT) + xheader_store ("linkpath", st); + else + write_long (st->link_name, GNUTYPE_LONGNAME); +} + /* NOTE: Cross recursion between start_header and write_extended */ static union block * @@ -410,7 +420,6 @@ write_extended (union block *old_header, char type) union block *header, hp; struct tar_stat_info foo; size_t size; - size_t bufsize; char *p; if (extended_header.buffer || extended_header.stk == NULL) @@ -1246,9 +1255,9 @@ dump_file (char *p, int top_level, dev_t parent_device) dup->nlink--; block_ordinal = current_block_ordinal (); - if (NAME_FIELD_SIZE <= strlen (link_name)) - write_long (link_name, GNUTYPE_LONGLINK); assign_string (¤t_stat_info.link_name, link_name); + if (NAME_FIELD_SIZE <= strlen (link_name)) + write_long_link (¤t_stat_info); current_stat_info.stat.st_size = 0; header = start_header (p, ¤t_stat_info); @@ -1488,7 +1497,9 @@ dump_file (char *p, int top_level, dev_t parent_device) char buf[UINTMAX_STRSIZE_BOUND]; memset (start->buffer + count, 0, bufsize - count); WARN ((0, 0, - _("%s: File shrank by %s bytes; padding with zeros"), + ngettext ("%s: File shrank by %s byte; padding with zeros", + "%s: File shrank by %s bytes; padding with zeros", + sizeleft), quotearg_colon (p), STRINGIFY_BIGINT (sizeleft, buf))); if (! ignore_failed_read_option) @@ -1573,9 +1584,9 @@ dump_file (char *p, int top_level, dev_t parent_device) return; } buffer[size] = '\0'; - if (size >= NAME_FIELD_SIZE) - write_long (buffer, GNUTYPE_LONGLINK); assign_string (¤t_stat_info.link_name, buffer); + if (size >= NAME_FIELD_SIZE) + write_long_link (¤t_stat_info); block_ordinal = current_block_ordinal (); current_stat_info.stat.st_size = 0; /* force 0 size on symlink */