ARCHIVE_WRITE_FREE(3)

πŸ“¦
version 3.8.11 Β· 2 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, centos-stream 10, debian trixie, fedora 43, fedora 44, freebsd 14.5, freebsd 15.1, nixos 26.05, nixpkgs unstable, opensuse-leap 16.0, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– ARCHIVE_WRITE_FREE(3) πŸ’–

okay bestie, so this is the Library Functions Manual page for ARCHIVE_WRITE_FREE(3) β€” the whole libarchive girlie squad of "functions for creating archives". yes the page name is one function but there's literally four of them here, they're a package deal, we love a friend group 🫢


✨ LIBRARY ✨

Streaming Archive Library β€” that's libarchive, link it with -larchive.


πŸŽ€ SYNOPSIS πŸŽ€

#include <archive.h>

int
archive_write_fail(struct archive *);

int
archive_write_close(struct archive *);

int
archive_write_finish(struct archive *);

int
archive_write_free(struct archive *);

look at them. four little guys. all returning int. all taking a struct archive *. iconic honestly πŸ’…


🌸 DESCRIPTION 🌸

archive_write_fail()

Always returns ARCHIVE_FATAL. every single time, no cap. and it marks the archive object as being unusable β€” like, once you call this, the only call that can possibly succeed afterwards is archive_write_free(), and that's just to release the resources and let it go.

so when do you use it? when the archive creation has to be aborted and you want to speed recovery. that's the whole point.

⚠️ heads up bestie: the created archive is likely to be malformed in this case. you're basically rage-quitting the archive. it's giving "we don't talk about that file" πŸ’€

archive_write_close()

Complete the archive and invoke the close callback. that's it, that's the whole vibe. she finishes the job ✨

archive_write_finish()

This is a deprecated synonym for archive_write_free(). she's retired, she still works, but don't be out here starting new relationships with her, okay? πŸ™ˆ

archive_write_free()

Invokes archive_write_close() if necessary, then releases all the resources. cleanup queen, main character energy, takes out the trash on her way out πŸ‘‘

but listen β€” if you need detailed information about archive_write_close() failures, you should be careful to call it separately, because you literally cannot obtain error information after archive_write_free() returns. once she's gone, she's gone. no receipts. so if you care about the details, do it in two steps, not one. iykyk 🫢


⭐ RETURN VALUES ⭐

These functions return ARCHIVE_OK on success, or ARCHIVE_FATAL. that's the whole menu. two options. very decisive of them πŸ’…


🌈 ERRORS 🌈

Detailed error codes and textual descriptions are available from the archive_errno() and archive_error_string() functions. go ask those two, they're the gossip girls who actually know what went wrong πŸ”₯


πŸ¦‹ SEE ALSO πŸ¦‹


mwah that's the page. this one shipped with Debian, dated February 2, 2012 β€” so yeah she's an elder but she's still slaying fr fr πŸ’–βœ¨πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from