+ int res;
+
+ if (pipe(hand) < 0)
+ {
+ logf(LOG_FATAL|LOG_ERRNO, "pipe");
+ exit(1);
+ }
+ if ((res = fork()) < 0)
+ {
+ logf(LOG_FATAL|LOG_ERRNO, "fork");
+ exit(1);
+ }
+ else if (res == 0) /* child */
+ {
+ char nbuf[100];
+
+ close(hand[0]);
+ child = 1;
+ sprintf(nbuf, "%s(%d)", me, getpid());
+ log_init(loglevel, nbuf, 0);
+ }
+ else /* parent */
+ {
+ close(hand[1]);
+ /* wait for child to take the call */
+ for (;;)
+ {
+ char dummy[1];
+ int res;
+
+ if ((res = read(hand[0], dummy, 1)) < 0 && errno != EINTR)
+ {
+ logf(LOG_FATAL|LOG_ERRNO, "handshake read");
+ exit(1);
+ }
+ else if (res >= 0)
+ break;
+ }
+ logf(LOG_DEBUG, "P: Child has taken the call");
+ close(hand[0]);