Return fatal when closing a failed writer

Once an archive writer enters the fatal state, close should report that failure instead of proceeding as though it were usable.

Resolves #3353
This commit is contained in:
subotac committed 2026-08-08 14:31:04 +03:00
1 parent 0c4749950a
commit 2af20746e6
1 file changed
+1 -2
+1 -2
View File
@@ -641,8 +641,7 @@ _archive_write_close(struct archive *_a)
int r = ARCHIVE_OK, r1 = ARCHIVE_OK;
archive_check_magic(&a->archive, ARCHIVE_WRITE_MAGIC,
ARCHIVE_STATE_ANY | ARCHIVE_STATE_FATAL,
"archive_write_close");
ARCHIVE_STATE_ANY, "archive_write_close");
if (a->archive.state == ARCHIVE_STATE_NEW
|| a->archive.state == ARCHIVE_STATE_CLOSED)
return (ARCHIVE_OK); /* Okay to close() when not open. */