From 66e271245dc0b689db4b5e16360ac3f87fec7feb Mon Sep 17 00:00:00 2001 From: CatsSky Date: Sat, 14 May 2022 21:32:22 +0800 Subject: [PATCH] fix history file open --- webview.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/webview.c b/webview.c index 89abcd5..659dc6e 100644 --- a/webview.c +++ b/webview.c @@ -113,18 +113,10 @@ void rose_load_changed_callback(WebKitWebView *webview, const char *uri = webkit_web_view_get_uri(webview); char *cookiefile = calloc(1, sizeof(char) * (strlen(options[CACHE]) + 32) + 1); sprintf(cookiefile, "%s/history", options[CACHE]); - FILE *f = fopen(cookiefile, "r"); - - if (!f) { - fclose(f); - FILE *f = fopen(cookiefile, "w"); - fclose(f); - } else { - fclose(f); - } FILE *cookie = fopen(cookiefile, "a"); - fprintf(f, "%s\n", uri); + + fprintf(cookie, "%s\n", uri); fclose(cookie); free(cookiefile); }