summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTim Kientzle <kientzle@FreeBSD.org>2005-03-13 01:47:31 +0000
committerTim Kientzle <kientzle@FreeBSD.org>2005-03-13 01:47:31 +0000
commit666cdfecc983e2bde4c929043fc6dbd598e1e0fb (patch)
tree5b47c481309a322d856646b9a64690debc22b66c /lib
parent721d5bfe2e0c02692b4587bbeb008508b8d728ef (diff)
Notes
Diffstat (limited to 'lib')
-rw-r--r--lib/libarchive/archive_write_open_file.c11
-rw-r--r--lib/libarchive/archive_write_open_filename.c11
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);
}