[Bug 74313] [patch] Fix build on Hurd without PATH_MAX

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Sat Feb 1 04:31:02 PST 2014


https://bugs.freedesktop.org/show_bug.cgi?id=74313

--- Comment #2 from Petter Reinholdtsen <pere at hungry.com> ---
You are right.  Sorry.  I got so excided when I got it building I forgot to
update the snprintf() call too.

Here is an updated patch.

--- spice-0.12.4.orig/server/tests/test_display_base.c
+++ spice-0.12.4/server/tests/test_display_base.c
@@ -87,12 +87,14 @@ static void regression_test(void)

     pid = fork();
     if (pid == 0) {
-        char buf[PATH_MAX];
+        int buflen = strlen(getenv("PATH"))+6;
+        char *buf = malloc(buflen);
         char *argp[] = {NULL};
         char *envp[] = {buf, NULL};

-        snprintf(buf, sizeof(buf), "PATH=%s", getenv("PATH"));
+        snprintf(buf, buflen, "PATH=%s", getenv("PATH"));
         execve("regression_test.py", argp, envp);
+        free(buf); /* In case the exec fail */
     } else if (pid > 0) {
         return;
     }

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-bugs/attachments/20140201/a2777721/attachment.html>


More information about the spice-bugs mailing list