#include <sys/stat.h>
#ifdef __APPLE__
# include <xlocale.h>
-#else
+#elif defined(HAVE_USELOCALE)
#include <locale.h>
#endif
*/
static char *config_GetConfigFile( vlc_object_t *obj )
{
- char *psz_file = config_GetPsz( obj, "config" );
+ char *psz_file = var_CreateGetNonEmptyString( obj, "config" );
+ var_Destroy( obj, "config" );
if( psz_file == NULL )
{
char *psz_dir = config_GetUserDir( VLC_CONFIG_DIR );
free( psz_readme );
}
/* Remove the old configuration file so that --reset-config
- * can work properly. */
+ * can work properly. Fortunately, Linux allows removing
+ * open files - with most filesystems. */
unlink( psz_old );
}
free( psz_old );
*/
fflush (file); /* Flush from run-time */
#ifndef WIN32
+#ifdef __APPLE__
+ fsync (fd); /* Flush from OS */
+#else
fdatasync (fd); /* Flush from OS */
+#endif
/* Atomically replace the file... */
if (utf8_rename (temporary, permanent))
utf8_unlink (temporary);