BUG/MINOR: mworker: fix validity check for the pipe FDs

Check if master-worker pipe getenv succeeded, also allow pipe fd 0 as
valid. On FreeBSD in quiet mode the stdin/stdout/stderr are closed
which lets the mworker_pipe to use fd 0 and fd 1. Additionally exit()
upon failure to create or get the master-worker pipe.

This needs to be backported to 1.8.
diff --git a/src/haproxy.c b/src/haproxy.c
index a1fe550..c7f21e3 100644
--- a/src/haproxy.c
+++ b/src/haproxy.c
@@ -2680,7 +2680,8 @@
 				/* master pipe to ensure the master is still alive  */
 				ret = pipe(mworker_pipe);
 				if (ret < 0) {
-					ha_warning("[%s.main()] Cannot create master pipe.\n", argv[0]);
+					ha_alert("[%s.main()] Cannot create master pipe.\n", argv[0]);
+					exit(EXIT_FAILURE);
 				} else {
 					memprintf(&msg, "%d", mworker_pipe[0]);
 					setenv("HAPROXY_MWORKER_PIPE_RD", msg, 1);
@@ -2689,11 +2690,15 @@
 					free(msg);
 				}
 			} else {
-				mworker_pipe[0] = atol(getenv("HAPROXY_MWORKER_PIPE_RD"));
-				mworker_pipe[1] = atol(getenv("HAPROXY_MWORKER_PIPE_WR"));
-				if (mworker_pipe[0] <= 0 || mworker_pipe[1] <= 0) {
-					ha_warning("[%s.main()] Cannot get master pipe FDs.\n", argv[0]);
+				char* rd = getenv("HAPROXY_MWORKER_PIPE_RD");
+				char* wr = getenv("HAPROXY_MWORKER_PIPE_WR");
+				if (!rd || !wr) {
+					ha_alert("[%s.main()] Cannot get master pipe FDs.\n", argv[0]);
+					atexit_flag = 0;// dont reexecute master process
+					exit(EXIT_FAILURE);
 				}
+				mworker_pipe[0] = atoi(rd);
+				mworker_pipe[1] = atoi(wr);
 			}
 		}