Add option to set directory for temporary files

With this patch applied the user can configure a directory to store
temporary/cache files. The history and cookies remain in RC_DIR.

I suppose the intent of writing the history to a temp file first is to
make the actual write an atomic operation. As rename() does not work
across mount points, we need to handle the temp file for the history
different to keep this behaviour.

Add a new type for the temp history file and handle this case different
when creating a temp file.
This commit is contained in:
Rene Kita
2021-09-02 17:11:36 +02:00
parent c515ea8a47
commit 9192ed59db
4 changed files with 22 additions and 4 deletions

View File

@@ -64,7 +64,7 @@ saveHistory(Hist *hist, size_t size)
if (hist == NULL || hist->list == NULL)
return;
tmpf = tmpfname(TMPF_DFL, NULL)->ptr;
tmpf = tmpfname(TMPF_HIST, NULL)->ptr;
if ((f = fopen(tmpf, "w")) == NULL) {
/* FIXME: gettextize? */
disp_err_message("Can't open history", FALSE);