From aa7cea405bac53a32fc61a0949cc5082db5de913 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 6 Jul 2021 21:09:19 +0200 Subject: [PATCH] Avoid ambiguity with tmpfile(3) --- libs/ardour/rc_configuration.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/libs/ardour/rc_configuration.cc b/libs/ardour/rc_configuration.cc index 87ddbdfa61..6f09ff1c50 100644 --- a/libs/ardour/rc_configuration.cc +++ b/libs/ardour/rc_configuration.cc @@ -150,22 +150,22 @@ int RCConfiguration::save_state() { const std::string rcfile = Glib::build_filename (user_config_directory(), user_config_file_name); - const std::string tmpfile = rcfile + temp_suffix; + const std::string tmp = rcfile + temp_suffix; XMLTree tree; tree.set_root (&get_state()); - if (!tree.write (tmpfile.c_str())){ + if (!tree.write (tmp.c_str())){ error << string_compose (_("Config file %1 not saved"), rcfile) << endmsg; - if (g_remove (tmpfile.c_str()) != 0) { - error << string_compose(_("Could not remove temporary config file at path \"%1\" (%2)"), tmpfile, g_strerror (errno)) << endmsg; + if (g_remove (tmp.c_str()) != 0) { + error << string_compose(_("Could not remove temporary config file at path \"%1\" (%2)"), tmp, g_strerror (errno)) << endmsg; } return -1; } - if (::g_rename (tmpfile.c_str(), rcfile.c_str()) != 0) { - error << string_compose (_("Could not rename temporary config file %1 to %2 (%3)"), tmpfile, rcfile, g_strerror(errno)) << endmsg; - if (g_remove (tmpfile.c_str()) != 0) { - error << string_compose(_("Could not remove temporary config file at path \"%1\" (%2)"), tmpfile, g_strerror (errno)) << endmsg; + if (::g_rename (tmp.c_str(), rcfile.c_str()) != 0) { + error << string_compose (_("Could not rename temporary config file %1 to %2 (%3)"), tmp, rcfile, g_strerror(errno)) << endmsg; + if (g_remove (tmp.c_str()) != 0) { + error << string_compose(_("Could not remove temporary config file at path \"%1\" (%2)"), tmp, g_strerror (errno)) << endmsg; } return -1; }