return header;
}
+#define FILL(field,byte) do { \
+ memset(field, byte, sizeof(field)-1); \
+ (field)[sizeof(field)-1] = 0; \
+} while (0)
+
/* Write a GNUTYPE_LONGLINK or GNUTYPE_LONGNAME block. */
static void
write_gnu_long_link (struct tar_stat_info *st, const char *p, char type)
size_t size = strlen (p) + 1;
size_t bufsize;
union block *header;
-
+ char *tmpname;
+
header = start_private_header ("././@LongLink", size);
+ FILL(header->header.mtime, '0');
+ FILL(header->header.mode, '0');
+ FILL(header->header.uid, '0');
+ FILL(header->header.gid, '0');
+ FILL(header->header.devmajor, 0);
+ FILL(header->header.devminor, 0);
+ uid_to_uname (0, &tmpname);
+ UNAME_TO_CHARS (tmpname, header->header.uname);
+ free (tmpname);
+ gid_to_gname (0, &tmpname);
+ GNAME_TO_CHARS (tmpname, header->header.gname);
+ free (tmpname);
+
strcpy (header->header.magic, OLDGNU_MAGIC);
header->header.typeflag = type;
finish_header (st, header, -1);
if (length > PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1)
{
- WARN ((0, 0, _("%s: file name is too long (max %d); not dumped"),
- quotearg_colon (name),
- PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1));
+ ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
+ quotearg_colon (name),
+ PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1));
return NULL;
}
i = split_long_name (name, length);
if (i == 0 || length - i - 1 > NAME_FIELD_SIZE)
{
- WARN ((0, 0,
- _("%s: file name is too long (cannot be split); not dumped"),
- quotearg_colon (name)));
+ ERROR ((0, 0,
+ _("%s: file name is too long (cannot be split); not dumped"),
+ quotearg_colon (name)));
return NULL;
}
case V7_FORMAT: /* old V7 tar format */
case USTAR_FORMAT:
case STAR_FORMAT:
- WARN ((0, 0,
- _("%s: link name is too long; not dumped"),
- quotearg_colon (st->link_name)));
- break;
+ ERROR ((0, 0,
+ _("%s: link name is too long; not dumped"),
+ quotearg_colon (st->link_name)));
+ break;
case OLDGNU_FORMAT:
case GNU_FORMAT:
case V7_FORMAT:
if (strlen (st->file_name) > NAME_FIELD_SIZE-1)
{
- WARN ((0, 0, _("%s: file name is too long (max %d); not dumped"),
- quotearg_colon (st->file_name),
- NAME_FIELD_SIZE - 1));
+ ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
+ quotearg_colon (st->file_name),
+ NAME_FIELD_SIZE - 1));
return NULL;
}
break;
else
MAJOR_TO_CHARS (st->devminor, header->header.devminor);
}
- else
+ else if (archive_format != GNU_FORMAT && archive_format != OLDGNU_FORMAT)
{
MAJOR_TO_CHARS (0, header->header.devmajor);
MINOR_TO_CHARS (0, header->header.devminor);
#endif
/* See if we want only new files, and check if this one is too old to
- put in the archive. */
+ put in the archive.
- if (!S_ISDIR (st->stat.st_mode)
+ This check is omitted if incremental_option is set *and* the
+ requested file is not explicitely listed in the command line. */
+
+ if (!(incremental_option && !is_individual_file (p))
+ && !S_ISDIR (st->stat.st_mode)
&& OLDER_STAT_TIME (st->stat, m)
&& (!after_date_option || OLDER_STAT_TIME (st->stat, c)))
{
- if (0 < top_level) /* equivalent to !incremental_option */
+ if (!incremental_option)
WARN ((0, 0, _("%s: file is unchanged; not dumped"),
quotearg_colon (p)));
- /* FIXME: recheck this return. */
return;
}