static GMainLoop *main_loop;
static gboolean restart = FALSE;
-int notify_fd;
+int notify_fd[2];
static gboolean fork_wait(void);
MM_RM_RETVM_IF((pid = fork()) < 0, FALSE, "Daemon fork failed");
if (pid != 0) {
- close(fds[1]);
/* Read in a string from the pipe */
MM_RM_RETVM_IF(read(fds[0], msg, sizeof(msg)) < 0,
FALSE, "Failed to create pipe to get child status");
close(fds[0]);
+ close(fds[1]);
/* Parent process closes up output side of pipe */
if (!strcmp(msg, MSG_DONE)) {
}
} else if (pid == 0) {
/* Child process closes up input side of pipe */
- close(fds[0]);
-
- notify_fd = fds[1];
+ notify_fd[0] = fds[0];
+ notify_fd[1] = fds[1];
}
return TRUE;