Changeset 914f20188c38ba6657c578fce381e1b42e651766
- Timestamp:
- 11/01/06 08:50:44
(2 years ago)
- Author:
- Rafaël Carré <funman@videolan.org>
- git-committer:
- Rafaël Carré <funman@videolan.org> 1162367444 +0000
- git-parent:
[8741be0247e758e02802869b6e2616fc79fa4370]
- git-author:
- Rafaël Carré <funman@videolan.org> 1162367444 +0000
- Message:
Makes file plugin fail to access directories
Some sanity checks
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| rf81778e |
r914f201 |
|
| 162 | 162 | else |
|---|
| 163 | 163 | { |
|---|
| | 164 | /* returns early if psz_path is a directory */ |
|---|
| | 165 | #ifdef HAVE_SYS_STAT_H |
|---|
| | 166 | struct stat stat_info; |
|---|
| | 167 | |
|---|
| | 168 | if( utf8_stat( p_access->psz_path, &stat_info ) ) |
|---|
| | 169 | { |
|---|
| | 170 | msg_Warn( p_access, "%s: %s", p_access->psz_path, |
|---|
| | 171 | strerror( errno ) ); |
|---|
| | 172 | return VLC_EGENERIC; |
|---|
| | 173 | } |
|---|
| | 174 | if S_ISDIR(stat_info.st_mode) |
|---|
| | 175 | { |
|---|
| | 176 | msg_Warn( p_access, "%s is a directory", p_access->psz_path ); |
|---|
| | 177 | return VLC_EGENERIC; |
|---|
| | 178 | } |
|---|
| | 179 | #endif |
|---|
| | 180 | |
|---|
| 164 | 181 | p_sys->b_seekable = VLC_TRUE; |
|---|
| 165 | 182 | p_sys->b_pace_control = VLC_TRUE; |
|---|
| | 183 | |
|---|
| 166 | 184 | } |
|---|
| 167 | 185 | |
|---|
| … | … | |
| 491 | 509 | static char *expand_path (const access_t *p_access, const char *path) |
|---|
| 492 | 510 | { |
|---|
| 493 | | if (strncmp (path, "~/", 2) == 0) |
|---|
| | 511 | if ( ( strlen (path) >= 2 ) && ( strncmp (path, "~/", 2) == 0 )) |
|---|
| 494 | 512 | { |
|---|
| 495 | 513 | char *res; |
|---|
| … | … | |
| 502 | 520 | |
|---|
| 503 | 521 | #if defined(WIN32) |
|---|
| 504 | | if (!strcasecmp (p_access->psz_access, "file") |
|---|
| | 522 | if ( ( strlen(p_access->psz_access ) >= 4 ) |
|---|
| | 523 | && !strcasecmp (p_access->psz_access, "file") |
|---|
| 505 | 524 | && ('/' == path[0]) && path[1] && (':' == path[2]) && ('/' == path[3])) |
|---|
| 506 | 525 | // Explorer can open path such as file:/C:/ or file:///C:/ |
|---|