1Subject: [PATCH] netperf: fix vfork/fork
2
3Upstream-Status: Pending
4
5Signed-off-by: Xin Ouyang <Xin.Ouyang@windriver.com>
6---
7 src/netserver.c |   12 ++++++++++--
8 1 files changed, 10 insertions(+), 2 deletions(-)
9
10diff --git a/src/netserver.c b/src/netserver.c
11index 379a106..f6a8b09 100644
12--- a/src/netserver.c
13+++ b/src/netserver.c
14@@ -1020,7 +1020,7 @@ process_requests()
15 void
16 spawn_child() {
17
18-#if defined(HAVE_FORK)
19+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
20
21   if (debug) {
22     fprintf(where,
23@@ -1038,7 +1038,11 @@ spawn_child() {
24
25   signal(SIGCLD,SIG_IGN);
26
27+#if defined(HAVE_FORK)
28   switch (fork()) {
29+#else
30+  switch (vfork()) {
31+#endif
32   case -1:
33     fprintf(where,
34 	    "%s: fork() error %s (errno %d)\n",
35@@ -1405,7 +1409,7 @@ scan_netserver_args(int argc, char *argv[]) {
36
37 void
38 daemonize() {
39-#if defined(HAVE_FORK)
40+#if defined(HAVE_FORK) || defined(HAVE_VFORK)
41
42   if (debug) {
43     fprintf(where,
44@@ -1419,7 +1423,11 @@ daemonize() {
45   fflush(stdout);
46   fflush(stderr);
47
48+#if defined(HAVE_FORK)
49   switch (fork()) {
50+#else
51+  switch (vfork()) {
52+#endif
53   case -1:
54     fprintf(stderr,
55 	    "%s: fork() error %s (errno %d)\n",
56--
571.7.1.1
58
59