From: Stephen Seo Date: Thu, 10 Apr 2025 06:00:55 +0000 (+0900) Subject: Attempt to fix write bug by setting pipe blocking X-Git-Url: https://git.seodisparate.com/stephenseo/LD53?a=commitdiff_plain;h=refs%2Fheads%2Farchive_create_fail_attempt_fix;p=SimpleArchiver Attempt to fix write bug by setting pipe blocking Attempts to fix https://github.com/Stephen-Seo/SimpleArchiver/issues/6 . --- diff --git a/src/archiver.c b/src/archiver.c index 2cb2452..418e5d9 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -6658,6 +6658,14 @@ SDArchiverStateRetStruct simple_archiver_write_v4( } } + const int existing_pipe_flags = fcntl(pipe_into_write, F_GETFL); + const int existing_pipe_flags_blocking = + existing_pipe_flags & ~O_NONBLOCK; + if (fcntl(pipe_into_write, F_SETFL, existing_pipe_flags_blocking) == -1) { + fprintf(stderr, + "ERROR: Unable to remove non-blocking on into-write-pipe!\n"); + return SDA_RET_STRUCT(SDAS_COMPRESSION_ERROR); + } simple_archiver_internal_cleanup_int_fd(&pipe_into_write); // Finish writing.