Skip to content

Commit

Permalink
Merge pull request #2723 from Voyager1/libdvdread-fix
Browse files Browse the repository at this point in the history
Libdvdread fix for SMB, NFS, VIDEO_TS files (non-Windows platforms). fixes #14316
  • Loading branch information
Voyager1 committed May 13, 2013
2 parents 846ccff + 56b4e56 commit d38b14e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 87 deletions.
3 changes: 3 additions & 0 deletions lib/libdvd/libdvdread/src/dvd_reader.c
Expand Up @@ -429,6 +429,9 @@ dvd_reader_t *DVDOpen( const char *ppath )
/* Also WIN32 does not have symlinks, so we don't need this bit of code. */

/* Resolve any symlinks and get the absolute dir name. */
#if defined(_XBMC) /* for XBMC, only do symlink resolution for (real) non-xbmc-VFS paths */
if ( path[0] == '/' )
#endif // _XBMC
{
if( ( cdir = open( ".", O_RDONLY ) ) >= 0 ) {
if( chdir( path_copy ) == -1 ) {
Expand Down
87 changes: 0 additions & 87 deletions lib/libdvd/patches/02-libdvdread_dvd_reader.c.diff

This file was deleted.

34 changes: 34 additions & 0 deletions lib/libdvd/patches/02-libdvdread_fix_symlinks_resolution_vfs.diff
@@ -0,0 +1,34 @@
diff --git a/lib/libdvd/libdvdread/src/dvd_reader.c b/lib/libdvd/libdvdread/src/dvd_reader.c
index d9544b3..f5ee550 100644
--- a/lib/libdvd/libdvdread/src/dvd_reader.c
+++ b/lib/libdvd/libdvdread/src/dvd_reader.c
@@ -429,10 +429,17 @@ dvd_reader_t *DVDOpen( const char *ppath )
/* Also WIN32 does not have symlinks, so we don't need this bit of code. */

/* Resolve any symlinks and get the absolute dir name. */
+#if defined(_XBMC) /* for XBMC, only do symlink resolution for (real) non-xbmc-VFS paths */
+ if ( path[0] == '/' )
+#endif // _XBMC
{
if( ( cdir = open( ".", O_RDONLY ) ) >= 0 ) {
if( chdir( path_copy ) == -1 ) {
+#if defined(_XBMC)
+ fprintf( stderr, "libdvdread: failed to change working directory to \"%s\": %s\n", path_copy, strerror(errno)); /* but ignore error */
+#else
goto DVDOpen_error;
+#endif // _XBMC
}
new_path = malloc(PATH_MAX+1);
if(!new_path) {
@@ -445,7 +452,11 @@ dvd_reader_t *DVDOpen( const char *ppath )
close( cdir );
cdir = -1;
if( retval == -1 ) {
+#if defined(_XBMC)
+ fprintf( stderr, "libdvdread: failed to reset working directory to \".\": %s\n", strerror(errno)); /* but ignore error */
+#else
goto DVDOpen_error;
+#endif // _XBMC
}
path_copy = new_path;
new_path = NULL;

0 comments on commit d38b14e

Please sign in to comment.