fcntl(pipeArray[1], F_SETFD, FD_CLOEXEC);
detach(char *device) {    pid_t childpid;    unsigned char exitCode;    int fd;    if (pipe(pipeArray) == -1)	exit(25);    childpid = fork();    if (childpid == -1)	exit(26);    if (childpid != 0) {        /* The parent only cares about notifications from the child. */        close (pipeArray[1]);        /* Certain signals are meant for our child, the watcher process. */        theChild = childpid;        set_signal(SIGINT, interrupt_child);        set_signal(SIGTERM, interrupt_child);        set_signal(SIGHUP, interrupt_child);        /* Read the pipe until the child gives us an exit code as a byte. */        while (read (pipeArray[0], &exitCode, 1) == -1) {	    switch (errno) {	        case EINTR: continue;	        default: exit (27); /* this will catch EIO in particular */	    }        }        switch (exitCode) {            case 0:	        break;	    case 33:	        fprintf(stderr, "%s already up, initiating redial\n", device);	        break;	    case 34:	        fprintf(stderr, "Failed to activate %s, retrying in the background\n", device);	        break;	    default:	        fprintf(stderr, "Failed to activate %s with error %d\n", device, exitCode);	        break;         }         exit(exitCode);    }    /* We're in the child process, which only writes the exit status     * of the pppd process to its parent (i.e., it reads nothing). */    close (pipeArray[0]);    /* Redirect stdio to /dev/null. */    fd = open("/dev/null", O_RDONLY);    dup2(fd, STDIN_FILENO);    close(fd);    fd = open("/dev/null", O_WRONLY);    dup2(fd, STDOUT_FILENO);    dup2(fd, STDERR_FILENO);    close(fd);    /* Become session and process group leader. */    setsid();    setpgid(0, 0);}