]> git.sesse.net Git - vlc/blobdiff - modules/misc/logger.c
transform: non functional changes to support more than 8-bits
[vlc] / modules / misc / logger.c
index ebcfe2651cbbb27353104705ca4ec5836cc9c6ee..d873817fa6ed08fc72199fc7ef1ce68370890a2b 100644 (file)
@@ -193,6 +193,7 @@ static int Open( vlc_object_t *p_this )
     if( p_sys == NULL )
         return VLC_ENOMEM;
 
+    p_sys->p_file = NULL;
     msg_callback_t cb = TextPrint;
     const char *filename = LOG_FILE_TEXT, *header = TEXT_HEADER;
     p_sys->footer = TEXT_FOOTER;
@@ -257,15 +258,19 @@ static int Open( vlc_object_t *p_this )
     else
 #endif
 #ifdef __ANDROID__
-    if( cb != AndroidPrint )
+    if( cb == AndroidPrint )
+    {
+        /* nothing to do */
+    }
+    else
 #endif
     {
         char *psz_file = var_InheritString( p_intf, "logfile" );
         if( !psz_file )
         {
 #ifdef __APPLE__
-# define LOG_DIR "Library/Logs/"
-            char *home = config_GetUserDir(VLC_DOCUMENTS_DIR);
+# define LOG_DIR "Library/Logs"
+            char *home = config_GetUserDir(VLC_HOME_DIR);
             if( home == NULL
              || asprintf( &psz_file, "%s/"LOG_DIR"/%s", home,
                           filename ) == -1 )
@@ -314,6 +319,7 @@ static void Close( vlc_object_t *p_this )
         closelog();
     else
 #endif
+    if( p_sys->p_file )
     {
         fputs( p_sys->footer, p_sys->p_file );
         fclose( p_sys->p_file );