From bdba94298d203da9db37310734b08427f95d9bd8 Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Fri, 1 Feb 2008 19:29:13 +0000 Subject: [PATCH] - Add warning message for failed rename call when saving config - Fix config saving on win32 (unlink old config before renaming the temporary/new one) --- src/config.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/config.c b/src/config.c index eaee285..8db0606 100644 --- a/src/config.c +++ b/src/config.c @@ -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);