[vlc-commits] Fix Hurd build
Samuel Thibault
git at videolan.org
Sun May 1 10:13:07 CEST 2016
vlc | branch: master | Samuel Thibault <samuel.thibault at ens-lyon.org> | Wed Apr 27 13:47:13 2016 +0200| [daa50fbf8e7d009ff1b224bdc06c7f68dfd61eaf] | committer: Rémi Denis-Courmont
Fix Hurd build
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.
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=daa50fbf8e7d009ff1b224bdc06c7f68dfd61eaf
---
modules/gui/skins2/src/theme_loader.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/gui/skins2/src/theme_loader.cpp b/modules/gui/skins2/src/theme_loader.cpp
index 1ec1dfc..b4cf7e8 100644
--- a/modules/gui/skins2/src/theme_loader.cpp
+++ b/modules/gui/skins2/src/theme_loader.cpp
@@ -549,7 +549,9 @@ 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];
+ long path_max = pathconf (".", _PC_PATH_MAX);
+ size_t maxsize = (path_max == -1 || path_max > 4096) ? 4096 : path_max;
+ char fname[BLOCKSIZE + maxsize];
while( 1 )
{
@@ -583,7 +585,7 @@ int tar_extract_all( TAR *t, char *prefix )
break;
}
- sprintf( fname, "%s/%s", prefix, buffer.header.name );
+ snprintf( fname, sizeof(fname), "%s/%s", prefix, buffer.header.name );
/* Check magic value in header */
if( strncmp( buffer.header.magic, "GNUtar", 6 ) &&
More information about the vlc-commits
mailing list