Changeset 7b98e85b48a69ad0519dee858fbbebd461c84537
- Timestamp:
- 05/20/08 18:01:37
(4 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1211299297 +0300
- git-parent:
[ce0b5da92eb3d06a34ce32b63421b605c8b19d2e]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1211299168 +0300
- Message:
Don't use stat() before opendir()
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6300760 |
r7b98e85 |
|
| 504 | 504 | { |
|---|
| 505 | 505 | mvar_t *s = mvar_New( name, "set" ); |
|---|
| 506 | | #ifdef HAVE_SYS_STAT_H |
|---|
| 507 | | struct stat stat_info; |
|---|
| 508 | | #endif |
|---|
| 509 | 506 | char **ppsz_dir_content; |
|---|
| 510 | 507 | int i_dir_content, i; |
|---|
| 511 | 508 | psz_dir = RealPath( p_intf, psz_dir ); |
|---|
| 512 | 509 | |
|---|
| 513 | | #ifdef HAVE_SYS_STAT_H |
|---|
| 514 | | if( (utf8_stat( psz_dir, &stat_info ) == -1 ) |
|---|
| 515 | | || !S_ISDIR( stat_info.st_mode ) |
|---|
| 516 | | # if defined( WIN32 ) |
|---|
| 517 | | && psz_dir[0] != '\0' && (psz_dir[0] != '\\' || psz_dir[1] != '\0') |
|---|
| 518 | | # endif |
|---|
| 519 | | ) |
|---|
| | 510 | #if defined( WIN32 ) |
|---|
| | 511 | if( psz_dir[0] != '\0' && (psz_dir[0] != '\\' || psz_dir[1] != '\0') ) |
|---|
| 520 | 512 | { |
|---|
| 521 | 513 | free( psz_dir ); |
|---|
| … | … | |
| 528 | 520 | InsensitiveAlphasort ) ) == -1 ) |
|---|
| 529 | 521 | { |
|---|
| 530 | | msg_Warn( p_intf, "error while scanning dir %s (%m)", psz_dir ); |
|---|
| | 522 | if( errno != ENOENT && errno != ENOTDIR ) |
|---|
| | 523 | msg_Warn( p_intf, "error while scanning dir %s (%m)", psz_dir ); |
|---|
| 531 | 524 | free( psz_dir ); |
|---|
| 532 | 525 | return s; |
|---|
| … | … | |
| 535 | 528 | for( i = 0; i < i_dir_content; i++ ) |
|---|
| 536 | 529 | { |
|---|
| | 530 | #ifdef HAVE_SYS_STAT_H |
|---|
| | 531 | struct stat stat_info; |
|---|
| | 532 | #endif |
|---|
| 537 | 533 | char *psz_name = ppsz_dir_content[i], *psz_ext, *psz_dummy; |
|---|
| 538 | 534 | char psz_tmp[strlen( psz_dir ) + 1 + strlen( psz_name ) + 1]; |
|---|