- Add warning message for failed rename call when saving config

- Fix config saving on win32 (unlink old config before renaming the temporary/new one)
This commit is contained in:
Stefan Gehn 2008-02-01 19:29:13 +00:00
parent 2587c4a1df
commit bdba94298d
1 changed files with 12 additions and 1 deletions

View File

@ -2501,7 +2501,18 @@ gkrellm_save_user_config(void)
fclose(ff);
}
fclose(f);
rename(config_new, config);
#if defined(WIN32)
/* windows rename() does not allow overwriting existing files! */
unlink(config);
#endif
i = rename(config_new, config);
if (i != 0)
{
printf(_("Cannot rename new config file %s to %s.\n"), config_new, config);
g_free(config);
g_free(config_new);
return;
}
#if defined (S_IRUSR)
mode = (S_IRUSR | S_IWUSR);