From: Stephen Seo Date: Tue, 29 Oct 2024 04:45:38 +0000 (+0900) Subject: Close read-pipe on xdg-mime's side in static.c X-Git-Tag: 1.0~20 X-Git-Url: https://git.seodisparate.com/js/bootstrap.bundle.min.js?a=commitdiff_plain;h=c952d1e06b8b061370651efcd0c1a8991647668e;p=c_simple_http 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. --- 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;