[vlc-devel] [PATCH] Fix hurd build

Samuel Thibault samuel.thibault at ens-lyon.org
Tue Apr 26 20:24:04 CEST 2016


theme_loader.cpp contains an unconditional use of PATH_MAX,
which is not defined on GNU/Hurd to avoid imposing build-time
limits. This change replaces its use with dynamic allocation of the
required size.
---
 modules/gui/skins2/src/theme_loader.cpp | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp
index 1ec1dfc..3badd00 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -549,7 +549,7 @@ int tar_extract_all( TAR *t, char *prefix )
     union tar_buffer buffer;
     int   len, err, getheader = 1, remaining = 0;
     FILE  *outfile = NULL;
-    char  fname[BLOCKSIZE + PATH_MAX];
+    char  *fname = NULL;
 
     while( 1 )
     {
@@ -566,6 +566,7 @@ int tar_extract_all( TAR *t, char *prefix )
         if( len != 0 && len != BLOCKSIZE )
         {
             fprintf( stderr, "gzread: incomplete block read\n" );
+            free( fname );
             return -1;
         }
 
@@ -583,6 +584,7 @@ int tar_extract_all( TAR *t, char *prefix )
                 break;
             }
 
+            fname  = malloc( strlen(prefix) + 1 + strlen(buffer.header.name) + 1 );
             sprintf( fname, "%s/%s", prefix, buffer.header.name );
 
             /* Check magic value in header */
@@ -590,6 +592,7 @@ int tar_extract_all( TAR *t, char *prefix )
                 strncmp( buffer.header.magic, "ustar", 5 ) )
             {
                 //fprintf(stderr, "not a tar file\n");
+                free( fname );
                 return -1;
             }
 
@@ -659,6 +662,8 @@ int tar_extract_all( TAR *t, char *prefix )
         }
     }
 
+    free( fname );
+
     return 0;
 }
 
-- 
2.6.4



More information about the vlc-devel mailing list