From c952d1e06b8b061370651efcd0c1a8991647668e Mon Sep 17 00:00:00 2001 From: Stephen Seo Date: Tue, 29 Oct 2024 13:45:38 +0900 Subject: [PATCH] Close read-pipe on xdg-mime's side in static.c The pipe probably doesn't need to be closed since it is closed by c_simple_http and the forked process stops while it is the only other thing with that read-pipe-fd. However, it probably would be best to close it so that during runtime all pipe fd's are closed after use. --- src/static.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/static.c b/src/static.c index 68f5259..43f33bf 100644 --- a/src/static.c +++ b/src/static.c @@ -211,6 +211,9 @@ C_SIMPLE_HTTP_StaticFileInfo c_simple_http_get_file(const char *static_dir, from_xdg_mime_pipe[1], STDOUT_FILENO); + // Close "read" side of pipe on "xdg-mime"'s side. + posix_spawn_file_actions_addclose(actions, from_xdg_mime_pipe[0]); + buf_size = 256; buf = malloc(buf_size); uint64_t buf_idx = 0;