aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_disk_posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'libarchive/archive_write_disk_posix.c')
-rw-r--r--libarchive/archive_write_disk_posix.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c
index 35b5aedf7f03..0168d0d411bd 100644
--- a/libarchive/archive_write_disk_posix.c
+++ b/libarchive/archive_write_disk_posix.c
@@ -1654,7 +1654,6 @@ _archive_write_disk_finish_entry(struct archive *_a)
{
struct archive_write_disk *a = (struct archive_write_disk *)_a;
int ret = ARCHIVE_OK;
- int oerrno;
archive_check_magic(&a->archive, ARCHIVE_WRITE_DISK_MAGIC,
ARCHIVE_STATE_HEADER | ARCHIVE_STATE_DATA,
@@ -1856,12 +1855,10 @@ finish_metadata:
a->fd = -1;
if (a->tmpname) {
if (rename(a->tmpname, a->name) == -1) {
- oerrno = errno;
- unlink(a->tmpname);
- errno = oerrno;
archive_set_error(&a->archive, errno,
- "Failed to safe write");
- ret = ARCHIVE_FATAL;
+ "Failed to rename temporary file");
+ ret = ARCHIVE_FAILED;
+ unlink(a->tmpname);
}
a->tmpname = NULL;
}
@@ -2148,8 +2145,11 @@ restore_entry(struct archive_write_disk *a)
if ((a->flags & ARCHIVE_EXTRACT_SAFE_WRITES) &&
S_ISREG(a->st.st_mode)) {
/* Use a temporary file to extract */
- if ((a->fd = la_mktemp(a)) == -1)
+ if ((a->fd = la_mktemp(a)) == -1) {
+ archive_set_error(&a->archive, errno,
+ "Can't create temporary file");
return ARCHIVE_FAILED;
+ }
a->pst = NULL;
en = 0;
} else {