Check if fopen() fails during generating html
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 21s
This commit is contained in:
parent
68551de565
commit
faa262ba95
1 changed files with 6 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue