__LA_DECL int archive_write_finish_entry(struct archive *);
__LA_DECL int archive_write_close(struct archive *);
+/* Marks the archive as FATAL so that a subsequent free() operation
+ * won't try to close() cleanly. Provides a fast abort capability
+ * when the client discovers that things have gone wrong. */
+__LA_DECL int archive_write_fail(struct archive *);
/* This can fail if the archive wasn't already closed, in which case
* archive_write_free() will implicitly call archive_write_close(). */
__LA_DECL int archive_write_free(struct archive *);
return ((a->vtable->archive_close)(a));
}
+int
+archive_write_fail(struct archive *a)
+{
+ a->state = ARCHIVE_STATE_FATAL;
+ return a->state;
+}
+
int
archive_write_free(struct archive *a)
{
.Dt ARCHIVE_WRITE_FREE 3
.Os
.Sh NAME
+.Nm archive_write_fail ,
.Nm archive_write_close ,
.Nm archive_write_finish ,
.Nm archive_write_free
.Sh SYNOPSIS
.In archive.h
.Ft int
+.Fn archive_write_fail "struct archive *"
+.Ft int
.Fn archive_write_close "struct archive *"
.Ft int
.Fn archive_write_finish "struct archive *"
.Fn archive_write_free "struct archive *"
.Sh DESCRIPTION
.Bl -tag -width indent
+.It Fn archive_write_fail
+Always returns
+.Cm ARCHIVE_FATAL .
+This marks the archive object as being unusable;
+after calling this function, the only call that can succeed is
+.Fn archive_write_free
+to release the resources.
+This can be used to speed recovery when the archive creation
+must be aborted.
+Note that the created archive is likely to be malformed in this case;
.It Fn archive_write_close
Complete the archive and invoke the close callback.
.It Fn archive_write_finish