30c66c3f4cd0e1dd293559453f03988174adc7ff
[vuplus_xbmc] / lib / libdvd / patches / 02-libdvdread_fix_symlinks_resolution_vfs.diff
1 diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c
2 index d9544b3..f5ee550 100644
3 --- a/lib/libdvd/libdvdread/src/dvd_reader.c
4 +++ b/lib/libdvd/libdvdread/src/dvd_reader.c
5 @@ -429,10 +429,17 @@ dvd_reader_t *DVDOpen( const char *ppath )
6                /* Also WIN32 does not have symlinks, so we don't need this bit of code. */
7  
8      /* Resolve any symlinks and get the absolute dir name. */
9 +#if defined(_XBMC) /* for XBMC, only do symlink resolution for (real) non-xbmc-VFS paths */
10 +       if ( path[0] == '/' )
11 +#endif // _XBMC
12         {
13        if( ( cdir  = open( ".", O_RDONLY ) ) >= 0 ) {
14          if( chdir( path_copy ) == -1 ) {
15 +#if defined(_XBMC)
16 +          fprintf( stderr, "libdvdread: failed to change working directory to \"%s\": %s\n", path_copy, strerror(errno)); /* but ignore error */
17 +#else
18            goto DVDOpen_error;
19 +#endif // _XBMC
20          }
21                 new_path = malloc(PATH_MAX+1);
22                 if(!new_path) {
23 @@ -445,7 +452,11 @@ dvd_reader_t *DVDOpen( const char *ppath )
24                 close( cdir );
25          cdir = -1;
26          if( retval == -1 ) {
27 +#if defined(_XBMC)
28 +          fprintf( stderr, "libdvdread: failed to reset working directory to \".\": %s\n", strerror(errno)); /* but ignore error */
29 +#else
30            goto DVDOpen_error;
31 +#endif // _XBMC
32          }
33                     path_copy = new_path;
34          new_path = NULL;