[vlc-commits] Small simplification

Rémi Denis-Courmont git at videolan.org
Sat Jun 18 11:31:44 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jun 18 11:48:26 2011 +0300| [20bc26941b4e1589191f56b9c95b914cdf533622] | committer: Rémi Denis-Courmont

Small simplification

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20bc26941b4e1589191f56b9c95b914cdf533622
---

 src/config/file.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/config/file.c b/src/config/file.c
index f0187b5..e6951bf 100644
--- a/src/config/file.c
+++ b/src/config/file.c
@@ -577,26 +577,24 @@ 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))
         vlc_unlink (temporary);
     /* (...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);



More information about the vlc-commits mailing list