Changeset 6d2739944db9944855aa9c849d3cd30414c45a5b

Show
Ignore:
Timestamp:
12/12/05 20:24:55 (3 years ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1134415495 +0000
git-parent:

[d708c14a27fec63e1bd463189b5272ae458bd877]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1134415495 +0000
Message:

Don't recurse in symbolic link - fixes #375

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/access/directory.c

    ra483f98 r6d27399  
    369369    return 0; 
    370370} 
     371 
    371372/***************************************************************************** 
    372373 * DemuxControl: 
     
    381382    return VLC_TRUE; 
    382383} 
     384 
    383385/***************************************************************************** 
    384386 * ReadDir: read a directory and add its content to the list 
    385387 *****************************************************************************/ 
    386 static int ReadDir( playlist_t *p_playlist, 
    387                     const char *psz_name, int i_mode, playlist_item_t *p_parent ) 
     388static int ReadDir( playlist_t *p_playlist, const char *psz_name, 
     389                    int i_mode, playlist_item_t *p_parent ) 
    388390{ 
    389391    struct dirent   **pp_dir_content; 
     
    466468#endif 
    467469            { 
     470#if defined( S_ISLNK ) 
     471/* 
     472 * FIXME: there is a ToCToU race condition here; but it is rather tricky^W^W 
     473 * impossible to fix while keeping some kind of portable code, and maybe even 
     474 * in a non-portable way. 
     475 */ 
     476                if( lstat( psz_uri, &stat_data ) 
     477                 || S_ISLNK(stat_data.st_mode) ) 
     478                { 
     479                    msg_Dbg( p_playlist, "Skipping directory symlink %s", 
     480                             psz_uri ); 
     481                    free( psz_uri ); 
     482                    continue; 
     483                } 
     484#endif 
    468485                if( i_mode == MODE_NONE ) 
    469486                {