]> git.sesse.net Git - vlc/commitdiff
Small simplification
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 18 Jun 2011 08:48:26 +0000 (11:48 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 18 Jun 2011 09:26:06 +0000 (12:26 +0300)
src/config/file.c

index f0187b5947936e4982472748b2e76be9a4b20b5d..e6951bff155e849048d544e4cc11a4fbc5696b7f 100644 (file)
@@ -577,11 +577,15 @@ static int SaveConfigFile (vlc_object_t *p_this)
         clearerr (file);
         goto error;
     }
-#if !defined( WIN32 ) && !defined( __OS2__ )
 #if defined(__APPLE__) || defined(__ANDROID__)
     fsync (fd); /* Flush from OS */
 #else
     fdatasync (fd); /* Flush from OS */
+#endif
+#if defined (WIN32) || defined (__OS2__)
+    /* Windows cannot (re)move open files nor overwrite existing ones */
+    fclose (file);
+    vlc_unlink (permanent);
 #endif
     /* Atomically replace the file... */
     if (vlc_rename (temporary, permanent))
@@ -589,14 +593,8 @@ static int SaveConfigFile (vlc_object_t *p_this)
     /* (...then synchronize the directory, err, TODO...) */
     /* ...and finally close the file */
     vlc_mutex_unlock (&lock);
-#endif
+#if !defined (WIN32) && !defined (__OS2__)
     fclose (file);
-#if defined( WIN32 ) || defined( __OS2__ )
-    /* Windows cannot remove open files nor overwrite existing ones */
-    vlc_unlink (permanent);
-    if (vlc_rename (temporary, permanent))
-        vlc_unlink (temporary);
-    vlc_mutex_unlock (&lock);
 #endif
 
     free (temporary);