If the output is not a regular file, it's okay to add it to the archive.

In particular, /dev/st0 can be added to an archive being written to /dev/st0.

Thanks to: Jaakko Heinonen
This commit is contained in:
kientzle 2005-03-13 01:47:31 +00:00
parent 21240a6daf
commit ebf75b4df5
2 changed files with 18 additions and 4 deletions

View File

@ -125,8 +125,15 @@ file_open(struct archive *a, void *client_data)
return (ARCHIVE_FATAL); return (ARCHIVE_FATAL);
} }
a->skip_file_dev = pst->st_dev; /*
a->skip_file_ino = pst->st_ino; * If the output file is a regular file, don't add it to
* itself. If it's a device file, it's okay to add the device
* entry to the output archive.
*/
if (S_ISREG(pst->st_mode)) {
a->skip_file_dev = pst->st_dev;
a->skip_file_ino = pst->st_ino;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }

View File

@ -125,8 +125,15 @@ file_open(struct archive *a, void *client_data)
return (ARCHIVE_FATAL); return (ARCHIVE_FATAL);
} }
a->skip_file_dev = pst->st_dev; /*
a->skip_file_ino = pst->st_ino; * If the output file is a regular file, don't add it to
* itself. If it's a device file, it's okay to add the device
* entry to the output archive.
*/
if (S_ISREG(pst->st_mode)) {
a->skip_file_dev = pst->st_dev;
a->skip_file_ino = pst->st_ino;
}
return (ARCHIVE_OK); return (ARCHIVE_OK);
} }