Close read-pipe on xdg-mime's side in static.c
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 20s

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.
This commit is contained in:
Stephen Seo 2024-10-29 13:45:38 +09:00
parent 574499252e
commit c952d1e06b

View file

@ -211,6 +211,9 @@ C_SIMPLE_HTTP_StaticFileInfo c_simple_http_get_file(const char *static_dir,
from_xdg_mime_pipe[1], from_xdg_mime_pipe[1],
STDOUT_FILENO); 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_size = 256;
buf = malloc(buf_size); buf = malloc(buf_size);
uint64_t buf_idx = 0; uint64_t buf_idx = 0;