]> git.sesse.net Git - vlc/commitdiff
Check for the good directory.
authorChristophe Mutricy <xtophe@videolan.org>
Wed, 22 Aug 2007 22:21:41 +0000 (22:21 +0000)
committerChristophe Mutricy <xtophe@videolan.org>
Wed, 22 Aug 2007 22:21:41 +0000 (22:21 +0000)
Fix some warnings

modules/misc/lua/vlclua.c
modules/misc/lua/vlclua.h

index f8a0a0b669a18d5224171df5b5827835c1fad8e8..9b3424d5f41ae485e5d5efb58e3fe888429e6d85 100644 (file)
@@ -259,24 +259,23 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
             return VLC_ENOMEM;
     }
 #   else
-    {
+    if( asprintf( &ppsz_dir_list[1], 
+                  "share" DIR_SEP "%s", luadirname ) < 0 )
+        return VLC_ENOMEM;
+
 #   ifdef HAVE_SYS_STAT_H
+    {    
         struct stat stat_info;
-        if( ( utf8_stat( "share/luaplaylist", &stat_info ) == -1 )
+        if( ( utf8_stat( ppsz_dir_list[1], &stat_info ) == -1 )
             || !S_ISDIR( stat_info.st_mode ) )
         {
+            free(ppsz_dir_list[1]);
             if( asprintf( &ppsz_dir_list[1], 
                           DATA_PATH DIR_SEP "%s", luadirname ) < 0 )
                 return VLC_ENOMEM;
         }
-        else
-#   endif
-        {
-            if( asprintf( &ppsz_dir_list[1], 
-                          "share" DIR_SEP "%s", luadirname ) < 0 )
-                return VLC_ENOMEM;
-        }
     }
+#   endif
 #   endif
 
     for( ppsz_dir = ppsz_dir_list; *ppsz_dir; ppsz_dir++ )
@@ -308,7 +307,9 @@ int vlclua_scripts_batch_execute( vlc_object_t *p_this,
         for( ppsz_file = ppsz_filelist; ppsz_file < ppsz_fileend; ppsz_file++ )
         {
             char  *psz_filename;
-            asprintf( &psz_filename, "%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file );
+            if( asprintf( &psz_filename, 
+                          "%s" DIR_SEP "%s", *ppsz_dir, *ppsz_file ) < 0)
+                return VLC_ENOMEM;
             msg_Dbg( p_this, "Trying Lua playlist script %s", psz_filename );
             
             i_ret = func( p_this, psz_filename, p_state, user_data );
index e51987440763493f12956967b229cbd93874a1a3..f40a4386f89562f3a630d3a5307c16964c5fa3d9 100644 (file)
@@ -93,4 +93,5 @@ void vlclua_read_meta_data( vlc_object_t *p_this,
 void vlclua_read_custom_meta_data( vlc_object_t *p_this,
         lua_State *p_state, int o, int t, input_item_t *p_input );
 
-#endif /* VLC_LUA_H */
\ No newline at end of file
+#endif /* VLC_LUA_H */
+