]> git.sesse.net Git - vlc/blob - extras/contrib/src/Patches/libdvdread.patch
e81321549366f4674933431ab3b8707b27514fa3
[vlc] / extras / contrib / src / Patches / libdvdread.patch
1 Only in libdvdread/dvdread: .dvd_input.c.swp
2 diff -ru libdvdread-0.9.4/dvdread/bswap.h libdvdread/dvdread/bswap.h
3 --- libdvdread-0.9.4/dvdread/bswap.h    2002-12-15 01:09:12.000000000 +0100
4 +++ libdvdread/dvdread/bswap.h  2005-08-31 19:24:57.000000000 +0200
5 @@ -65,7 +65,7 @@
6   * functionality! 
7   */
8  
9 -#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__)
10 +#elif defined(__FreeBSD__) || defined(__sun) || defined(__bsdi__) || defined( __BEOS__ )
11  #define B2N_16(x) \
12   x = ((((x) & 0xff00) >> 8) | \
13        (((x) & 0x00ff) << 8))
14 diff -ru libdvdread-0.9.4/dvdread/dvd_reader.c libdvdread/dvdread/dvd_reader.c
15 --- libdvdread-0.9.4/dvdread/dvd_reader.c       2003-02-13 23:31:21.000000000 +0100
16 +++ libdvdread/dvdread/dvd_reader.c     2005-08-31 19:24:57.000000000 +0200
17 @@ -303,8 +303,7 @@
18      if( path == NULL )
19        return 0;
20  
21 -    ret = stat( path, &fileinfo );
22 -    if( ret < 0 ) {
23 +    if( *path && (ret = stat( path, &fileinfo ) < 0) ) {
24         /* If we can't stat the file, give up */
25         fprintf( stderr, "libdvdread: Can't stat %s\n", path );
26         perror("");
27 @@ -315,7 +314,7 @@
28      have_css = dvdinput_setup();
29  
30      /* First check if this is a block/char device or a file*/
31 -    if( S_ISBLK( fileinfo.st_mode ) || 
32 +    if( !*path || S_ISBLK( fileinfo.st_mode ) || 
33         S_ISCHR( fileinfo.st_mode ) || 
34         S_ISREG( fileinfo.st_mode ) ) {
35  
36 @@ -344,14 +343,16 @@
37  
38         /* Resolve any symlinks and get the absolut dir name. */
39         {
40 +           char *current_path;
41             char *new_path;
42 -           int cdir = open( ".", O_RDONLY );
43 -           
44 -           if( cdir >= 0 ) {
45 +
46 +           current_path = getcwd( NULL, PATH_MAX );
47 +           if( current_path ) {
48                 chdir( path_copy );
49                 new_path = getcwd( NULL, PATH_MAX );
50 -               fchdir( cdir );
51 -               close( cdir );
52 +               chdir( current_path );
53 +               free( current_path );
54 +
55                 if( new_path ) {
56                     free( path_copy );
57                     path_copy = new_path;
58 @@ -504,10 +505,12 @@
59              sprintf( filename, "%s%s%s", path,
60                       ( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
61                       ent->d_name );
62 +            closedir( dir );
63              return 0;
64          }
65      }
66  
67 +    closedir( dir );
68      return -1;
69  }
70  
71 Only in libdvdread/dvdread: dvd_reader.c.orig