Patch-Source: https://github.com/tats/w3m/pull/276.patch
--
From 855e956d0c64125336dbff1651734411555b29f7 Mon Sep 17 00:00:00 2001
From: fcd <git@fcd.dev>
Date: Sun, 30 Jul 2023 15:54:07 +0300
Subject: [PATCH] create history file if it doesn't exist

When history is enabled but there is no history file, w3m logs an error
message. Change that behavior to create a history file if it doesn't
exists.
---
 history.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/history.c b/history.c
index 0c427ff32..d0ec5e238 100644
--- a/history.c
+++ b/history.c
@@ -90,9 +90,7 @@ saveHistory(Hist *hist, size_t size)
 	return;
 
     histf = rcFile(HISTORY_FILE);
-    if (stat(histf, &st) == -1)
-	goto fail;
-    if (hist->mtime != (long long)st.st_mtime) {
+    if (!stat(histf, &st) && hist->mtime != (long long)st.st_mtime) {
 	fhist = newHist();
 	if (loadHistory(fhist) || mergeHistory(fhist, hist))
 	    disp_err_message("Can't merge history", FALSE);
