summaryrefslogtreecommitdiffstats
path: root/lib/libarchive/archive_read_open_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libarchive/archive_read_open_file.c')
-rw-r--r--lib/libarchive/archive_read_open_file.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libarchive/archive_read_open_file.c b/lib/libarchive/archive_read_open_file.c
index 0da7d7c..1538c5b 100644
--- a/lib/libarchive/archive_read_open_file.c
+++ b/lib/libarchive/archive_read_open_file.c
@@ -110,9 +110,10 @@ file_open(struct archive *a, void *client_data)
return (ARCHIVE_FATAL);
}
if (fstat(mine->fd, &st) == 0) {
- /* Set dev/ino of archive file so extract won't overwrite. */
- a->skip_file_dev = st.st_dev;
- a->skip_file_ino = st.st_ino;
+ /* If we're reading a file from disk, ensure that we don't
+ overwrite it with an extracted file. */
+ if (S_ISREG(st.st_mode))
+ archive_read_extract_set_skip_file(a, st.st_dev, st.st_ino);
/* Remember mode so close can decide whether to flush. */
mine->st_mode = st.st_mode;
} else {
OpenPOWER on IntegriCloud