Package: libquicktime-dev Severity: serious Tags: patch Justification: fails to build from source
Dear Maintainer, * What led up to the situation? libquicktime FTBFS on hurd-i386 (cf. http://people.debian.org/~sthibault/graph-top.txt). Building the source from the git repository fails with : lqt_codecinfo.c:614:21: error: 'PATH_MAX' undeclared (first use in this function) * What exactly did you do (or not do) that was effective (or ineffective)? The attached patches fix this issue and should be portable enough to be adopted upstream. WBR, Cyril Roelandt. -- System Information: Debian Release: wheezy/sid APT prefers unreleased APT policy: (500, 'unreleased'), (500, 'unstable') Architecture: hurd-i386 (i686-AT386) Kernel: GNU-Mach 1.3.99/Hurd-0.3 Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
diff --git a/src/lqt_codecinfo.c b/src/lqt_codecinfo.c index a04b10a..1a95be6 100644 --- a/src/lqt_codecinfo.c +++ b/src/lqt_codecinfo.c @@ -601,7 +601,8 @@ static int scan_for_plugins(const char * plugin_dir, lqt_codec_info_t ** databas { char * pos; int ret; - char * filename; + char * filename = NULL; + size_t filename_len = 0, new_size = 0; DIR * directory; struct dirent * directory_entry; struct stat status; @@ -611,8 +612,6 @@ static int scan_for_plugins(const char * plugin_dir, lqt_codec_info_t ** databas lqt_codec_info_t * video_codecs_end; lqt_codec_info_t * audio_codecs_end; - filename = malloc(PATH_MAX * sizeof(char)); - /* Set the end pointers so we can quickly add codecs after */ @@ -662,6 +661,14 @@ static int scan_for_plugins(const char * plugin_dir, lqt_codec_info_t ** databas /* Now, the file should be a valid plugin, construct the filename */ + new_size = strlen(plugin_dir) + strlen(directory_entry->d_name) + 2; + if (new_size > filename_len) + { + filename_len = new_size; + filename = realloc(filename, filename_len); + if (!filename) + exit(EXIT_FAILURE); + } strcpy(filename, plugin_dir); strcat(filename, "/"); strcat(filename, directory_entry->d_name); diff --git a/utils/rechunk.c b/utils/rechunk.c index 1e4be29..0266112 100644 --- a/utils/rechunk.c +++ b/utils/rechunk.c @@ -46,7 +46,7 @@ static char ** add_frames_from_file(char ** input_frames, { FILE * input; char * pos; - char filename[PATH_MAX+10]; + char *filename = NULL; input = fopen(list_filename, "r"); if(!input) @@ -56,7 +56,7 @@ static char ** add_frames_from_file(char ** input_frames, return (char**)0; } - while(fgets(filename, PATH_MAX+10, input)) + while(getline(&filename, NULL, input) != -1) { /* Delete trailing '\n' and '\r' */ @@ -72,7 +72,10 @@ static char ** add_frames_from_file(char ** input_frames, break; if(pos == filename) + { + free(filename); return input_frames; + } pos--; } @@ -83,6 +86,8 @@ static char ** add_frames_from_file(char ** input_frames, input_frames = realloc(input_frames, sizeof(char*) * *total_input_frames); input_frames[*total_input_frames - 1] = strdup(filename); // fprintf(stderr, "Adding file %s\n", input_frames[*total_input_frames - 1]); + free(filename); + filename = NULL; } return input_frames; }