X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fconfig%2Ffile.c;h=10a483e1f08a36df72e5a2c1990215f9e0f164a6;hb=75dda08f9fd7b2e80b9587dbf329bc262b3c8ba9;hp=9b779ab1b420ed9372435da63dcd57bac6d75d10;hpb=644185a5fe78fff280bbb35deb2f4e4ab51ad143;p=vlc diff --git a/src/config/file.c b/src/config/file.c index 9b779ab1b4..10a483e1f0 100644 --- a/src/config/file.c +++ b/src/config/file.c @@ -680,7 +680,8 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, #ifndef WIN32 fdatasync (fd); /* Flush from OS */ /* Atomically replace the file... */ - utf8_rename (temporary, permanent); + if (utf8_rename (temporary, permanent)) + utf8_unlink (temporary); /* (...then synchronize the directory, err, TODO...) */ /* ...and finally close the file */ vlc_mutex_unlock (&lock); @@ -689,7 +690,8 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name, #ifdef WIN32 /* Windows cannot remove open files nor overwrite existing ones */ utf8_unlink (permanent); - utf8_rename (temporary, permanent); + if (utf8_rename (temporary, permanent)) + utf8_unlink (temporary); vlc_mutex_unlock (&lock); #endif