diff options
Diffstat (limited to 'history.cpp')
-rw-r--r-- | history.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/history.cpp b/history.cpp index 0c7bc618..f8183f5d 100644 --- a/history.cpp +++ b/history.cpp @@ -1338,7 +1338,7 @@ bool history_t::save_internal_via_rewrite() for (size_t attempt = 0; attempt < 10 && out_fd == -1; attempt++) { char *narrow_str = wcs2str(tmp_name_template.c_str()); - if (narrow_str && mkstemp(narrow_str)) + if (narrow_str && mktemp(narrow_str)) { /* It was successfully templated; try opening it atomically */ tmp_name = str2wcstring(narrow_str); @@ -1507,6 +1507,11 @@ void history_t::save_internal(bool vacuum) /* Try doing a fast append */ ok = save_internal_via_appending(); } + if (! ok) + { + /* We did not or could not append; rewrite the file ("vacuum" it) */ + ok = this->save_internal_via_rewrite(); + } } void history_t::save(void) |