diff options
Diffstat (limited to 'w3mbookmark.c')
-rw-r--r-- | w3mbookmark.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/w3mbookmark.c b/w3mbookmark.c index 4355536..a306f26 100644 --- a/w3mbookmark.c +++ b/w3mbookmark.c @@ -79,6 +79,7 @@ print_bookmark_panel(char *bmark, char *url, char *title, char *charset) } } printf("</select>\n"); + fclose(f); } printf(bkmark_src2, html_quote(url), html_quote(title)); } @@ -99,7 +100,7 @@ create_new_bookmark(char *bmark, char *section, char *title, char *url, fprintf(f, "<body>\n<h1>Bookmarks</h1>\n"); fprintf(f, "<h2>%s</h2>\n<ul>\n", section); fprintf(f, "<li><a href=\"%s\">%s</a>\n", url, title); - fprintf(f, end_section); + fprintf(f, "%s", end_section); fprintf(f, "</ul>\n</body>\n</html>\n"); fclose(f); } @@ -168,7 +169,10 @@ insert_bookmark(char *bmark, struct parsed_tagarg *data) /* In this case, a new bookmark is appeneded after the bookmark file */ return create_new_bookmark(bmark, section, title, url, "a"); } - f = fopen(bmark, "w"); + if ((f = fopen(bmark, "w")) == NULL) { + printf("\nCannot open bookmark %s\n", bmark); + return FALSE; + } while (tl->nitem) { fputs(popText(tl), f); } |