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-Tag: 1.19_dev0~1 X-Git-Url: https://git.seodisparate.com/stephenseo/js/darkmode.js?a=commitdiff_plain;h=e6dbcf7336293e06028ae4a529d242bb9d89e657;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 026e813..bde9317 100644 --- a/src/archiver.c +++ b/src/archiver.c @@ -6627,6 +6627,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.