summaryrefslogtreecommitdiff
path: root/parallel/glunix/patches/patch-bj
blob: 8a2efc991188f507bb72c85338be6c058bfb5146 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
$NetBSD: patch-bj,v 1.2 2005/05/29 14:38:33 wiz Exp $

--- glunix/src/part/mpart.cc.orig	1997-09-05 21:30:01.000000000 +0200
+++ glunix/src/part/mpart.cc
@@ -46,6 +46,7 @@
 #define __THIS_MODULE  MODULE_PART
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <errno.h>
 #include <string.h>
 #include <unistd.h>
@@ -270,13 +271,18 @@ Part_SpawnDaemon(char *path, char **argv
     }
     if (pid == 0) {
 	// Child executes here
+#ifndef __NetBSD__
 	close(pipeFds[1]);
+#endif
 	if (dup2(pipeFds[0], STDIN_FILENO) < 0) {
 	    DE("dup2(STDIN) failed: %s\n", strerror(errno));
 	    exit(-1);
 	}
-
+#ifdef __NetBSD__
+	if (dup2(pipeFds[1], STDOUT_FILENO) < 0) {
+#else
 	if (dup2(pipeFds[0], STDOUT_FILENO) < 0) {
+#endif
 	    DE("dup2(STDOUT) failed: %s\n", strerror(errno));
 	    exit(-1);
 	}
@@ -291,10 +297,15 @@ Part_SpawnDaemon(char *path, char **argv
 	DE("CloseOneExec(%d) failed, pipeFds[0,1] = (%d,%d): %s\n",
 	   pipeFds[1], pipeFds[0], pipeFds[1], strerror(errno));
     }
+#ifndef __NetBSD__
     close(pipeFds[0]);
-
+#endif
     *pidPtr = pid;
+#ifdef __NetBSD__
+    *fdPtr = pipeFds[0];
+#else
     *fdPtr = pipeFds[1];
+#endif
 
     return True;
 }