Check if fopen() fails during generating html
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s

This commit is contained in:
Stephen Seo 2024-11-10 20:47:56 +09:00
parent 68551de565
commit faa262ba95

View file

@ -450,6 +450,12 @@ int generate_paths_fn(const void *key,
// Save the html.
FILE *fd = fopen(generated_path, "wb");
if (!fd) {
fprintf(stderr,
"WARNING Failed to open \"%s\" for writing, skipping!\n",
generated_path);
return 0;
}
unsigned long fwrite_ret = fwrite(html_buf, 1, html_buf_size, fd);
if (fwrite_ret < html_buf_size) {
fclose(fd);