diff --git a/src/command/cmd_defs.c b/src/command/cmd_defs.c index d3091279..ce39f3c5 100644 --- a/src/command/cmd_defs.c +++ b/src/command/cmd_defs.c @@ -2976,8 +2976,14 @@ command_docgen(void) cmds = g_list_insert_sorted(cmds, (gpointer)pcmd, (GCompareFunc)_cmp_command); } - FILE* toc_fragment = fopen("toc_fragment.html", "w"); - FILE* main_fragment = fopen("main_fragment.html", "w"); + auto_FILE FILE* toc_fragment = fopen("toc_fragment.html", "w"); + auto_FILE FILE* main_fragment = fopen("main_fragment.html", "w"); + + if (!toc_fragment || !main_fragment) { + printf("\nError opening html files: %s.\n", strerror(errno)); + g_list_free(cmds); + return; + } fputs("