tags 885289 patch
thanks

On Mon, 2017-12-25 at 22:49 -0500, Aaron M. Ucko wrote:
> Source: yoshimi
> Version: 1.5.6-2
> Severity: important
> Tags: upstream
> Justification: fails to build from source
> User: debian-h...@lists.debian.org
> Usertags: hurd-i386

> The Hurd notoriously has no static PATH_MAX.  Best practice is to
> accommodate whatever you actually encounter (with the help of, e.g.,
> the GNU libc extension get_current_dir_name); alternatively, you can
> look up _PC_PATH_MAX via pathconf or supply a fallback constant
> (traditionally 4096).
> 
> Could you please take a look?

Hi,

Attached is a patch fixing the PATH_MAX issues of the package yoshimi
1.5.6-2.

Thanks!

Index: yoshimi-1.5.6/src/Misc/Config.cpp
===================================================================
--- yoshimi-1.5.6.orig/src/Misc/Config.cpp
+++ yoshimi-1.5.6/src/Misc/Config.cpp
@@ -231,17 +231,16 @@ bool Config::Setup(int argc, char **argv
     }
     if (restoreState)
     {
-        char * fp;
+        char *fp = NULL;
         if (! StateFile.size()) goto no_state0;
-        else fp = new char [PATH_MAX];
+        fp = realpath (StateFile.c_str(), NULL);
+        if (fp == NULL) goto no_state0;
 
-        if (! realpath (StateFile.c_str(), fp)) goto no_state1;
         StateFile = fp;
-        delete (fp);
+        free (fp);
 
         if (! isRegFile(StateFile))
         {
-            no_state1: delete (fp);
             no_state0: Log("Invalid state file specified for restore " + StateFile, 2);
             return true;
         }
Index: yoshimi-1.5.6/src/Misc/MiscFuncs.cpp
===================================================================
--- yoshimi-1.5.6.orig/src/Misc/MiscFuncs.cpp
+++ yoshimi-1.5.6/src/Misc/MiscFuncs.cpp
@@ -339,9 +339,9 @@ string MiscFuncs::setExtension(string fn
 // replace 'src' with a different one in the compilation directory
 string MiscFuncs::localPath(string leaf)
 {
-    char *tmpath;
-    tmpath = (char*) malloc(PATH_MAX);
-    getcwd (tmpath, PATH_MAX);
+    char *tmpath = getcwd (NULL, 0);
+    if (tmpath == NULL)
+       return "";
     string path = (string) tmpath;
     size_t found = path.rfind("/src");
     if (found != string::npos)
_______________________________________________
pkg-multimedia-maintainers mailing list
pkg-multimedia-maintainers@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-multimedia-maintainers

Reply via email to