/* Dump a single file, recursing on directories. P is the file name
to dump. TOP_LEVEL tells whether this is a top-level call; zero
means no, positive means yes, and negative means an incremental
- dump where it's irrelevant. PARENT_DEVICE is the device of P's
+ dump. PARENT_DEVICE is the device of P's
parent directory; it is examined only if TOP_LEVEL is zero.
Set global CURRENT_STAT to stat output for this file. */
char type;
union block *exhdr;
char save_typeflag;
+ time_t original_ctime;
struct utimbuf restore_times;
- off_t restore_size;
/* FIXME: `header' and `upperbound' might be used uninitialized in this
function. Reported by Bruno Haible. */
return;
}
+ original_ctime = current_stat.st_ctime;
restore_times.actime = current_stat.st_atime;
restore_times.modtime = current_stat.st_mtime;
- restore_size = current_stat.st_size;
#ifdef S_ISHIDDEN
if (S_ISHIDDEN (current_stat.st_mode))
/* Now output all the files in the directory. */
- errno = 0; /* FIXME: errno should be read-only */
+ errno = 0;
directory = opendir (p);
if (!directory)
f = open (p, O_RDONLY | O_BINARY);
if (f < 0)
{
- WARN ((0, errno, _("Cannot add file %s"), p));
+ if (! top_level && errno == ENOENT)
+ WARN ((0, 0, _("%s: file removed before we read it"), p));
+ else
+ WARN ((0, errno, _("Cannot add file %s"), p));
if (!ignore_failed_read_option)
exit_status = TAREXIT_FAILURE;
return;
struct stat final_stat;
if (fstat (f, &final_stat) != 0)
ERROR ((0, errno, "%s: fstat", p));
- else if (final_stat.st_mtime != restore_times.modtime
- || final_stat.st_size != restore_size)
- ERROR ((0, errno, _("%s: file changed as we read it"), p));
+ else if (final_stat.st_ctime != original_ctime)
+ ERROR ((0, 0, _("%s: file changed as we read it"), p));
if (close (f) != 0)
ERROR ((0, errno, _("%s: close"), p));
if (atime_preserve_option)