From: Cole Robinson Date: Fri, 8 Jan 2010 17:08:06 +0000 (-0500) Subject: util: Remove logging handlers in virExec X-Git-Tag: v0.7.6~197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2861390866bcbcd6abc0ecb4e07011ae5e9e4198;p=thirdparty%2Flibvirt.git util: Remove logging handlers in virExec This allows debug statements and raised errors in hook functions to actually be logged somewhere (stderr). Users can enable debugging in the daemon and now see more info in /var/log/libvirt/... --- diff --git a/src/util/util.c b/src/util/util.c index 44a4b2fffb..ba6b0dbbca 100644 --- a/src/util/util.c +++ b/src/util/util.c @@ -334,6 +334,7 @@ __virExec(virConnectPtr conn, int pipeerr[2] = {-1,-1}; int childout = -1; int childerr = -1; + int logprio; sigset_t oldmask, newmask; struct sigaction sig_action; @@ -452,6 +453,13 @@ __virExec(virConnectPtr conn, of being seen / logged */ virSetErrorFunc(NULL, NULL); + /* Make sure any hook logging is sent to stderr, since virExec will + * close any unknown FDs (including logging handlers) before launching + * the new process */ + logprio = virLogGetDefaultPriority(); + virLogReset(); + virLogSetDefaultPriority(logprio); + /* Clear out all signal handlers from parent so nothing unexpected can happen in our child once we unblock signals */