By requesting the pid in virCommandRunAsync, fdstream was claiming
that it would manually wait for the process. But on the failure
path, the child process was being leaked.
* src/fdstream.c (virFDStreamOpenFileInternal): Auto-reap child.
# include <sys/un.h>
#endif
#include <netinet/in.h>
-#include <signal.h>
#include "fdstream.h"
#include "virterror_internal.h"
struct stat sb;
virCommandPtr cmd = NULL;
int errfd = -1;
- pid_t pid = 0;
VIR_DEBUG("st=%p path=%s flags=%x offset=%llu length=%llu mode=%o delete=%d",
st, path, flags, offset, length, mode, delete);
}
virCommandSetErrorFD(cmd, &errfd);
- if (virCommandRunAsync(cmd, &pid) < 0)
+ if (virCommandRunAsync(cmd, NULL) < 0)
goto error;
VIR_FORCE_CLOSE(childfd);
return 0;
error:
-#ifndef WIN32
- if (pid)
- kill(SIGTERM, pid);
-#endif
virCommandFree(cmd);
VIR_FORCE_CLOSE(fds[0]);
VIR_FORCE_CLOSE(fds[1]);