+ if (pid) {
+ /*
+ * The parent process exits once it has received one byte from
+ * the reading end of the pipe. If the child exits before it
+ * was able to complete its setup (acquire the lock on the
+ * semaphore), the read() below will return zero. In this case
+ * we let the parent die unsuccessfully.
+ */
+ char c;
+ int ret;
+ close(fd[1]);
+ ret = read(fd[0], &c, 1);
+ if (ret <= 0) {
+ DSS_EMERG_LOG(("child terminated unexpectedly\n"));
+ exit(EXIT_FAILURE);
+ }
+ exit(EXIT_SUCCESS);
+ }
+ close(fd[0]);