diff --git a/env_universal_common.cpp b/env_universal_common.cpp index 88ec7749b..fd188e8a3 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -568,7 +568,7 @@ bool env_universal_t::open_temporary_file(const wcstring &directory, wcstring *o int result_fd = -1; char *narrow_str = wcs2str(tmp_name_template.c_str()); #if HAVE_MKOSTEMP - result_fd = mkostemp(narrow_str, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC); + result_fd = mkostemp(narrow_str, O_CLOEXEC); if (result_fd >= 0) { tmp_name = str2wcstring(narrow_str); diff --git a/history.cpp b/history.cpp index a3ef0ee90..abbfa5e84 100644 --- a/history.cpp +++ b/history.cpp @@ -1376,7 +1376,7 @@ bool history_t::save_internal_via_rewrite() { char *narrow_str = wcs2str(tmp_name_template.c_str()); #if HAVE_MKOSTEMP - out_fd = mkostemp(narrow_str, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC | O_CLOEXEC); + out_fd = mkostemp(narrow_str, O_CLOEXEC); if (out_fd >= 0) { tmp_name = str2wcstring(narrow_str);