Fix the cpio bug tested for by r182092 of usr.bin/cpio/test.

Since various 'find' incantations can emit container directories
in various orders, we cannot refuse to update a dir because it's
apparently the same age.

MFC after:	3 days
This commit is contained in:
Tim Kientzle 2008-08-24 05:01:01 +00:00
parent c9c5c49045
commit 8d14bd8cc2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=182093

View file

@ -861,7 +861,11 @@ restore_entry(struct archive_write_disk *a)
/* TODO: if it's a symlink... */
if (a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER) {
/*
* NO_OVERWRITE_NEWER doesn't apply to directories.
*/
if ((a->flags & ARCHIVE_EXTRACT_NO_OVERWRITE_NEWER)
&& !S_ISDIR(a->st.st_mode)) {
if (!older(&(a->st), a->entry)) {
archive_set_error(&a->archive, 0,
"File on disk is not older; skipping.");