diff options
author | axel <axel@liljencrantz.se> | 2006-11-23 20:40:23 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-11-23 20:40:23 +1000 |
commit | cab80b452bb3dbd65d5e8a1eeb869d84a7a94742 (patch) | |
tree | 4234e9b7cb5e97d80980d94e5f772f34e6737ce0 /wildcard.c | |
parent | 338d32a7c63bbe6f788dc684bbc17ec2c3712676 (diff) |
Fix bug where tab completions for implicit 'cd' would ignore symbolic links to directories
darcs-hash:20061123104023-ac50b-7245f70e0f6fbbc97358e32c6dc7ca5258f24a53.gz
Diffstat (limited to 'wildcard.c')
-rw-r--r-- | wildcard.c | 30 |
1 files changed, 18 insertions, 12 deletions
@@ -391,22 +391,28 @@ static void get_desc( wchar_t *fn, string_buffer_t *sb, int is_cmd ) static int test_flags( wchar_t *filename, int flags ) { - if( !(flags & EXECUTABLES_ONLY) && !(flags & DIRECTORIES_ONLY) ) - return 1; - - struct stat buf; - if( wstat( filename, &buf ) == -1 ) + if( flags & DIRECTORIES_ONLY ) { - return 0; + struct stat buf; + if( wstat( filename, &buf ) == -1 ) + { + return 0; + } + + if( !S_ISDIR( buf.st_mode ) ) + { + return 0; + } } - - if( S_ISDIR( buf.st_mode ) ) - return 1; + if( flags & EXECUTABLES_ONLY ) - return ( waccess( filename, X_OK ) == 0); - - return 0; + { + if ( waccess( filename, X_OK ) != 0) + return 0; + } + + return 1; } |