Package: pvm
Version: 3.4.5-12.2
Severity: important
Tags: patch
Usertags: hurd
Attached is a patch to enable successful build of pvm on
GNU/Hurd. It should be applied after the patch:
06-thread-safe-ctime.patch, preferably last.
Thanks!
--- pvm-3.4.5/srcpvmd.c.06-patched 2011-04-15 09:03:19.000000000 +0200
+++ pvm-3.4.5/src/pvmd.c 2011-04-15 23:31:10.000000000 +0200
@@ -3836,7 +3836,11 @@
int pid; /* task pid */
int pfd[2]; /* pipe back from task */
struct task *tp; /* new task context */
+#ifndef __GNU__
char path[MAXPATHLEN];
+#else
+ char *path = NULL;
+#endif
struct stat sb;
char **ep, **eplist;
int i;
@@ -3868,7 +3872,16 @@
eplist = CINDEX(name, '/') ? nullep : epaths;
for (ep = eplist; *ep; ep++) {
+#ifndef __GNU__
(void)strcpy(path, *ep);
+#else
+ free (path);
+ if (path = strdup(*ep) == NULL) {
+ pvmlogerror("cannot allocate memory\n");
+ task_free(tp);
+ return PvmNoFile;
+ }
+#endif
if (path[0])
(void)strcat(path, "/");
(void)strncat(path, name, sizeof(path) - strlen(path) - 1);
@@ -3939,12 +3952,18 @@
if (socketpair(AF_UNIX, SOCK_STREAM, 0, pfd) == -1) {
pvmlogperror("forkexec() socketpair");
task_free(tp);
+#ifdef __GNU__
+ free (path);
+#endif
return PvmOutOfRes;
}
#else
if (pipe(pfd) == -1) {
pvmlogperror("forkexec() pipe");
task_free(tp);
+#ifdef __GNU__
+ free (path);
+#endif
return PvmOutOfRes;
}
#endif
@@ -4077,6 +4096,9 @@
(void)close(pfd[0]);
(void)close(pfd[1]);
task_free(tp);
+#ifdef __GNU__
+ free (path);
+#endif
return PvmOutOfRes;
}
(void)close(pfd[1]);
@@ -4094,12 +4116,18 @@
tp->t_a_out = STRALLOC(name);
*tpp = tp;
+#ifdef __GNU__
+ free (path);
+#endif
return 0;
}
if (pvmdebmask & PDMTASK) {
pvmlogprintf("forkexec() didn't find <%s>\n", name);
}
task_free(tp);
+#ifdef __GNU__
+ free (path);
+#endif
return PvmNoFile;
}