From cf0ee0f6e48a18caa2d6df5d213da3bf9315b99a Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Thu, 10 Jan 2008 13:47:49 +0000 Subject: [PATCH] Change virExec() such that with --enable-debug, stdout and stderr no longer go to /dev/null. --- ChangeLog | 5 +++++ src/util.c | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/ChangeLog b/ChangeLog index c9b275aa37..816d775a5c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Jan 10 13:46:14 GMT 2008 Mark McLoughlin + + * src/util.c: change virExec() such that with --enable-debug, + stdout and stderr no longer go to /dev/null. + Thu Jan 10 13:44:17 GMT 2008 Mark McLoughlin * src/util.[ch]: Add virRun() helper function (Dan Berrange) diff --git a/src/util.c b/src/util.c index 755c4c2c79..d23237ef2c 100644 --- a/src/util.c +++ b/src/util.c @@ -157,10 +157,17 @@ _virExec(virConnectPtr conn, if (dup2(infd >= 0 ? infd : null, STDIN_FILENO) < 0) _exit(1); +#ifndef ENABLE_DEBUG if (dup2(pipeout[1] > 0 ? pipeout[1] : null, STDOUT_FILENO) < 0) _exit(1); if (dup2(pipeerr[1] > 0 ? pipeerr[1] : null, STDERR_FILENO) < 0) _exit(1); +#else /* ENABLE_DEBUG */ + if (pipeout[1] > 0 && dup2(pipeout[1], STDOUT_FILENO) < 0) + _exit(1); + if (pipeerr[1] > 0 && dup2(pipeerr[1], STDERR_FILENO) < 0) + _exit(1); +#endif /* ENABLE_DEBUG */ close(null); if (pipeout[1] > 0)