diff options
Diffstat (limited to 'lib/libarchive/archive_write_open_file.c')
-rw-r--r-- | lib/libarchive/archive_write_open_file.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/libarchive/archive_write_open_file.c b/lib/libarchive/archive_write_open_file.c index 106420f..65cdbb6 100644 --- a/lib/libarchive/archive_write_open_file.c +++ b/lib/libarchive/archive_write_open_file.c @@ -125,8 +125,15 @@ file_open(struct archive *a, void *client_data) 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); } |