diff options
| author | Tim Kientzle <kientzle@FreeBSD.org> | 2005-03-13 01:47:31 +0000 |
|---|---|---|
| committer | Tim Kientzle <kientzle@FreeBSD.org> | 2005-03-13 01:47:31 +0000 |
| commit | 666cdfecc983e2bde4c929043fc6dbd598e1e0fb (patch) | |
| tree | 5b47c481309a322d856646b9a64690debc22b66c /lib | |
| parent | 721d5bfe2e0c02692b4587bbeb008508b8d728ef (diff) | |
Notes
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/libarchive/archive_write_open_file.c | 11 | ||||
| -rw-r--r-- | lib/libarchive/archive_write_open_filename.c | 11 |
2 files changed, 18 insertions, 4 deletions
diff --git a/lib/libarchive/archive_write_open_file.c b/lib/libarchive/archive_write_open_file.c index 106420f3ed4f..65cdbb604b05 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); } diff --git a/lib/libarchive/archive_write_open_filename.c b/lib/libarchive/archive_write_open_filename.c index 106420f3ed4f..65cdbb604b05 100644 --- a/lib/libarchive/archive_write_open_filename.c +++ b/lib/libarchive/archive_write_open_filename.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); } |
