From: Stephen Seo Date: Wed, 25 Dec 2024 12:16:52 +0000 (+0900) Subject: Fix case when archiving from read-only directory X-Git-Tag: 1.10^2~10 X-Git-Url: https://git.seodisparate.com/stephenseo/css/v4-font-face.min.css?a=commitdiff_plain;h=9f682a9fe3c2541f91268ba3b0f0e8982f50ebe5;p=SimpleArchiver Fix case when archiving from read-only directory A temporary file is usually created to store compressed archive chunks/files which is located where the files are. This commit falls-back to using `tmpfile()` if the first attempt to create a temporary file fails. --- diff --git a/src/archiver.c b/src/archiver.c index 4534ca6..c0c9aaf 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -3602,7 +3602,10 @@ int simple_archiver_write_v2(FILE *out_f, SDArchiverState *state, } if (!temp_fd) { - return SDAS_INTERNAL_ERROR; + temp_fd = tmpfile(); + if (!temp_fd) { + return SDAS_INTERNAL_ERROR; + } } // Handle SIGPIPE.