Patch to fix FTBFS of pvm on GNU/Hurd
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.
Note: Another, rather easy one to port, a PATH_MAX issue. This mail is
so far only sent to debian-hurd for review.
BTW: How to find out which packages build-depends (not depends) on
pvm-dev? I lost which package now, but was interested since I've patched
this package. Was it scilab or scalapack?
diff -ur pvm-3.4.5/src/pvmd.c pvm-3.4.5.new/src/pvmd.c
--- pvm-3.4.5/src/pvmd.c 2011-04-14 22:38:13.000000000 +0200
+++ pvm-3.4.5.new/src/pvmd.c 2011-04-14 22:46:26.000000000 +0200
@@ -3836,7 +3836,12 @@
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;
+#endif
struct stat sb;
char **ep, **eplist;
int i;
@@ -3856,10 +3861,16 @@
if ((tid = tid_new()) < 0) {
pvmlogerror("forkexec() out of tids?\n");
+#ifdef __GNU__
+ free (path);
+#endif
return PvmOutOfRes;
}
if ((tp = task_new(tid)) == NULL) {
pvmlogerror("forkexec() too many tasks?\n");
+#ifdef __GNU__
+ free (path);
+#endif
return PvmOutOfRes;
}
@@ -3868,7 +3879,12 @@
eplist = CINDEX(name, '/') ? nullep : epaths;
for (ep = eplist; *ep; ep++) {
+#ifndef __GNU__
(void)strcpy(path, *ep);
+#else
+ if (path = strdup(*ep) == NULL)
+ pvmlogerror("cannot allocate memory\n");
+#endif
if (path[0])
(void)strcat(path, "/");
(void)strncat(path, name, sizeof(path) - strlen(path) - 1);
@@ -3939,12 +3955,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 +4099,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 +4119,19 @@
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;
}
Reply to: