File: 11-path_max.patch

package info (click to toggle)
libquicktime 2%3A1.2.4-17
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,832 kB
  • sloc: ansic: 55,312; sh: 10,976; makefile: 473; sed: 16
file content (105 lines) | stat: -rw-r--r-- 3,159 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
From: Cyril Roelandt <tipecaml@gmail.com>
Date: Wed, 30 Aug 2023 15:19:30 +0200
Subject: Avoid the use of PATH_MAX to allow building quicktime on hurd.

Bug-Debian: http://bugs.debian.org/670338
Reviewed-by: Alessio Treglia <alessio@debian.org>
Last-Update: 2012-05-21
Forwarded: Burkhard Plaum <plaum@ipf.uni-stuttgart.de>

Forwarded: Burkhard Plaum <plaum@ipf.uni-stuttgart.de>
---
 src/lqt_codecinfo.c | 13 ++++++++++---
 utils/rechunk.c     | 17 +++++++++++++++++
 2 files changed, 27 insertions(+), 3 deletions(-)

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..c58bab7 100644
--- a/utils/rechunk.c
+++ b/utils/rechunk.c
@@ -46,7 +46,11 @@ static char ** add_frames_from_file(char ** input_frames,
   {
   FILE * input;
   char * pos;
+#ifdef PATH_MAX
   char filename[PATH_MAX+10];
+#else
+  char *filename = NULL;
+#endif
 
   input = fopen(list_filename, "r");
   if(!input)
@@ -56,7 +60,11 @@ static char ** add_frames_from_file(char ** input_frames,
     return (char**)0;
     }
 
+#ifdef PATH_MAX
   while(fgets(filename, PATH_MAX+10, input))
+#else
+  while(getline(&filename, NULL, input) != -1)
+#endif
     {
     /* Delete trailing '\n' and '\r' */
 
@@ -72,7 +80,12 @@ static char ** add_frames_from_file(char ** input_frames,
         break;
 
       if(pos == filename)
+        {
+#ifndef PATH_MAX
+        free(filename);
+#endif
         return input_frames;
+        }
       
       pos--;      
       }
@@ -83,6 +96,10 @@ 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]);
+#ifndef PATH_MAX
+    free(filename);
+    filename = NULL;
+#endif
     }
   return input_frames;
   }