Avoid ambiguity with tmpfile(3)
This commit is contained in:
parent
4ac7df699d
commit
aa7cea405b
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue