diff --git a/src/util/virdaemon.c b/src/util/virdaemon.c index 99530fd1468e8774e5f47fb10b521e83370e94b6..6182ca3c2125138092823cfe02ab8527d5688cf6 100644 --- a/src/util/virdaemon.c +++ b/src/util/virdaemon.c @@ -20,7 +20,9 @@ #include +#include #include +#include #include #include #include @@ -30,8 +32,6 @@ #include "virfile.h" #include "virlog.h" #include "viralloc.h" -#include "virprocess.h" -#include "vircommand.h" #include "configmake.h" @@ -44,7 +44,7 @@ virDaemonForkIntoBackground(const char *argv0) if (virPipeQuiet(statuspipe) < 0) return -1; - pid_t pid = virFork(); + pid_t pid = fork(); switch (pid) { case 0: { @@ -73,7 +73,7 @@ virDaemonForkIntoBackground(const char *argv0) if (setsid() < 0) goto cleanup; - nextpid = virFork(); + nextpid = fork(); switch (nextpid) { case 0: /* grandchild */ return statuspipe[1]; @@ -97,14 +97,15 @@ virDaemonForkIntoBackground(const char *argv0) default: { /* parent */ - int exitstatus = 0; + int got, exitstatus = 0; int ret; char status; VIR_FORCE_CLOSE(statuspipe[1]); /* We wait to make sure the first child forked successfully */ - if (virProcessWait(pid, &exitstatus, 0) < 0 || + if ((got = waitpid(pid, &exitstatus, 0)) < 0 || + got != pid || exitstatus != 0) { goto error; }