Close data file in parse_file_with_callback() at the end - libgrapheme - unicod… | |
git clone git://git.suckless.org/libgrapheme | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit c8b34aa04ac8702e55ba4b8946d6794c9c6056f5 | |
parent af792ebe99c6301fb5b5436f856b9589ad0fd5ea | |
Author: Laslo Hunhold <[email protected]> | |
Date: Fri, 1 Dec 2023 09:37:28 +0100 | |
Close data file in parse_file_with_callback() at the end | |
This otherwise leads to build problems on macOS because of too many | |
open files due to leaked file descriptors. | |
Thank you, zeromake (https://blog.zeromake.com), for reporting this! | |
Signed-off-by: Laslo Hunhold <[email protected]> | |
Diffstat: | |
M gen/util.c | 8 ++++++++ | |
1 file changed, 8 insertions(+), 0 deletions(-) | |
--- | |
diff --git a/gen/util.c b/gen/util.c | |
@@ -282,6 +282,14 @@ parse_file_with_callback(const char *fname, | |
} | |
} | |
+ /* close file */ | |
+ if (fclose(fp)) { | |
+ fprintf(stderr, "parse_file_with_callback: fclose '%s': %s.\n", | |
+ fname, strerror(errno)); | |
+ exit(1); | |
+ } | |
+ | |
+ /* cleanup */ | |
free(line); | |
free(field); | |
} |