Commit 1f2024f6 authored by Benjamin Drung's avatar Benjamin Drung

Refresh 0005-hurd.patch

parent 28f8eed3
......@@ -24,7 +24,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
#include <unistd.h> /* chdir, getcwd */
#include <limits.h> /* PATH_MAX */
#include <dirent.h> /* opendir, readdir */
@@ -437,6 +438,12 @@ dvd_reader_t *DVDOpen( const char *ppath
@@ -452,6 +453,12 @@
if( chdir( path_copy ) == -1 ) {
goto DVDOpen_error;
}
......@@ -37,7 +37,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
new_path = malloc(PATH_MAX+1);
if(!new_path) {
goto DVDOpen_error;
@@ -444,6 +451,7 @@ dvd_reader_t *DVDOpen( const char *ppath
@@ -459,6 +466,7 @@
if( getcwd( new_path, PATH_MAX ) == NULL ) {
goto DVDOpen_error;
}
......@@ -45,7 +45,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
retval = fchdir( cdir );
close( cdir );
cdir = -1;
@@ -659,17 +667,23 @@ static dvd_file_t *DVDOpenFileUDF( dvd_r
@@ -703,17 +711,23 @@
* or -1 on file not found.
* or -2 on path not found.
*/
......@@ -71,28 +71,29 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
( ( path[ strlen( path ) - 1 ] == '/' ) ? "" : "/" ),
ent->d_name );
closedir(dir);
@@ -680,9 +694,9 @@ static int findDirFile( const char *path
@@ -724,7 +738,7 @@
return -1;
}
-static int findDVDFile( dvd_reader_t *dvd, const char *file, char *filename )
+static int findDVDFile( dvd_reader_t *dvd, const char *file, char **filename )
{
- char video_path[ PATH_MAX + 1 ];
+ char *video_path = NULL;
const char *nodirfile;
int ret;
@@ -738,9 +752,11 @@
@@ -696,6 +710,8 @@ static int findDVDFile( dvd_reader_t *dv
ret = findDirFile( dvd->path_root, nodirfile, filename );
if( ret < 0 ) {
- char video_path[ PATH_MAX + 1 ];
+ char *video_path = NULL;
/* Try also with adding the path, just in case. */
+ video_path = malloc( strlen( dvd->path_root ) + 10 + 1 );
+ if( video_path == NULL ) return 0;
sprintf( video_path, "%s/VIDEO_TS/", dvd->path_root );
ret = findDirFile( video_path, nodirfile, filename );
if( ret < 0 ) {
@@ -703,9 +719,11 @@ static int findDVDFile( dvd_reader_t *dv
@@ -748,9 +764,11 @@
sprintf( video_path, "%s/video_ts/", dvd->path_root );
ret = findDirFile( video_path, nodirfile, filename );
if( ret < 0 ) {
......@@ -104,7 +105,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
}
return 1;
@@ -716,20 +734,22 @@ static int findDVDFile( dvd_reader_t *dv
@@ -761,20 +779,22 @@
*/
static dvd_file_t *DVDOpenFilePath( dvd_reader_t *dvd, char *filename )
{
......@@ -122,14 +123,14 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return NULL;
}
dev = dvdinput_open( full_path );
dev = dvdinput_open( full_path, NULL, NULL );
if( !dev ) {
fprintf( stderr, "libdvdread:DVDOpenFilePath:dvdinput_open %s failed\n", full_path );
+ free( full_path );
return NULL;
}
@@ -737,6 +757,7 @@ static dvd_file_t *DVDOpenFilePath( dvd_
@@ -782,6 +802,7 @@
if( !dvd_file ) {
fprintf( stderr, "libdvdread:DVDOpenFilePath:dvd_file malloc failed\n" );
dvdinput_close(dev);
......@@ -137,7 +138,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return NULL;
}
dvd_file->dvd = dvd;
@@ -748,6 +769,7 @@ static dvd_file_t *DVDOpenFilePath( dvd_
@@ -794,6 +815,7 @@
if( stat( full_path, &fileinfo ) < 0 ) {
fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
......@@ -145,7 +146,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
free( dvd_file );
dvdinput_close( dev );
return NULL;
@@ -756,6 +778,7 @@ static dvd_file_t *DVDOpenFilePath( dvd_
@@ -802,6 +824,7 @@
dvd_file->title_devs[ 0 ] = dev;
dvd_file->filesize = dvd_file->title_sizes[ 0 ];
......@@ -153,7 +154,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return dvd_file;
}
@@ -811,7 +834,7 @@ static dvd_file_t *DVDOpenVOBUDF( dvd_re
@@ -858,7 +881,7 @@
static dvd_file_t *DVDOpenVOBPath( dvd_reader_t *dvd, int title, int menu )
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
......@@ -161,8 +162,8 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
+ char *full_path = NULL;
struct stat fileinfo;
dvd_file_t *dvd_file;
int i;
@@ -834,13 +857,15 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
@@ -881,13 +904,15 @@
} else {
sprintf( filename, "VTS_%02i_0.VOB", title );
}
......@@ -173,13 +174,13 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return NULL;
}
dev = dvdinput_open( full_path );
dev = dvdinput_open( full_path, NULL, NULL );
if( dev == NULL ) {
+ free( full_path );
free( dvd_file );
return NULL;
}
@@ -848,6 +873,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
@@ -895,6 +920,7 @@
if( stat( full_path, &fileinfo ) < 0 ) {
fprintf( stderr, "libdvdread: Can't stat() %s.\n", filename );
dvdinput_close(dev);
......@@ -187,7 +188,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
free( dvd_file );
return NULL;
}
@@ -860,7 +886,7 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
@@ -909,7 +935,7 @@
for( i = 0; i < TITLES_MAX; ++i ) {
sprintf( filename, "VTS_%02i_%i.VOB", title, i + 1 );
......@@ -196,7 +197,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
break;
}
@@ -875,11 +901,13 @@ static dvd_file_t *DVDOpenVOBPath( dvd_r
@@ -924,11 +950,13 @@
dvd_file->filesize += dvd_file->title_sizes[ i ];
}
if( !dvd_file->title_devs[ 0 ] ) {
......@@ -210,7 +211,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return dvd_file;
}
@@ -1001,7 +1029,7 @@ static int DVDFileStatVOBPath( dvd_reade
@@ -1054,7 +1082,7 @@
int menu, dvd_stat_t *statbuf )
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
......@@ -219,7 +220,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
struct stat fileinfo;
off_t tot_size;
off_t parts_size[ 9 ];
@@ -1013,11 +1041,14 @@ static int DVDFileStatVOBPath( dvd_reade
@@ -1066,11 +1094,14 @@
else
sprintf( filename, "VTS_%02d_%d.VOB", title, menu ? 0 : 1 );
......@@ -235,7 +236,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return -1;
}
@@ -1029,7 +1060,7 @@ static int DVDFileStatVOBPath( dvd_reade
@@ -1082,7 +1113,7 @@
int cur;
for( cur = 2; cur < 10; cur++ ) {
sprintf( filename, "VTS_%02d_%d.VOB", title, cur );
......@@ -244,7 +245,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
break;
if( stat( full_path, &fileinfo ) < 0 ) {
@@ -1048,6 +1079,7 @@ static int DVDFileStatVOBPath( dvd_reade
@@ -1101,6 +1132,7 @@
for( n = 0; n < nr_parts; n++ )
statbuf->parts_size[ n ] = parts_size[ n ];
......@@ -252,19 +253,13 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return 0;
}
@@ -1056,7 +1088,7 @@ int DVDFileStat( dvd_reader_t *dvd, int
dvd_read_domain_t domain, dvd_stat_t *statbuf )
{
char filename[ MAX_UDF_FILE_NAME_LEN ];
- char full_path[ PATH_MAX + 1 ];
+ char *full_path = NULL;
struct stat fileinfo;
uint32_t size;
@@ -1112,17 +1144,19 @@ int DVDFileStat( dvd_reader_t *dvd, int
@@ -1164,18 +1196,20 @@
return 0;
}
} else {
- char full_path[ PATH_MAX + 1 ];
+ char *full_path = NULL;
- if( findDVDFile( dvd, filename, full_path ) ) {
+ if( findDVDFile( dvd, filename, &full_path ) ) {
if( stat( full_path, &fileinfo ) < 0 )
......@@ -277,8 +272,7 @@ Signed-off-by: Matteo F. Vescovi <mfvescovi@gmail.com>
return 0;
}
}
+ free( full_path );
}
+ free( full_path );
return -1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment