prepare to upload
[debian/tar] / src / create.c
index a1e90a33679f12b0119953cbf465d64bd1e21eb5..b36cf1372fe6b3bf40ef48e8f6e1ff4f87e0858b 100644 (file)
@@ -26,6 +26,8 @@
 #include "common.h"
 #include <hash.h>
 
+extern int debian_longlink_hack;
+
 /* Error number to use when an impostor is discovered.
    Pretend the impostor isn't there.  */
 enum { IMPOSTOR_ERRNO = ENOENT };
@@ -735,7 +737,7 @@ write_header_name (struct tar_stat_info *st)
       return write_short_name (st);
     }
   else if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
-          < strlen (st->file_name))
+          < strlen (st->file_name) + debian_longlink_hack)
     return write_long_name (st);
   else
     return write_short_name (st);
@@ -1456,7 +1458,7 @@ dump_hard_link (struct tar_stat_info *st)
          block_ordinal = current_block_ordinal ();
          assign_string (&st->link_name, link_name);
          if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT)
-             < strlen (link_name))
+             < strlen (link_name) + debian_longlink_hack)
            write_long_link (st);
 
          st->stat.st_size = 0;
@@ -1678,9 +1680,9 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
      put in the archive.
 
      This check is omitted if incremental_option is set *and* the
-     requested file is not explicitely listed in the command line. */
+     requested file is not explicitly listed in the command line.  */
 
-  if (!(incremental_option && !is_individual_file (p))
+  if (! (incremental_option && ! top_level)
       && !S_ISDIR (st->stat.st_mode)
       && OLDER_TAR_STAT_TIME (*st, m)
       && (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
@@ -1797,6 +1799,7 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
              set_exit_status (TAREXIT_DIFFERS);
            }
          else if (atime_preserve_option == replace_atime_preserve
+                  && fd && (is_dir || original_size != 0)
                   && set_file_atime (fd, parentfd, name, st->atime) != 0)
            utime_error (p);
        }