On Wed, Feb 24, 2016 at 02:27:36PM +0100, Paolo Bonzini wrote:
> From: Dimitris Aragiorgis <dim...@arrikto.com>
> 
> In case of daemonize, use the logfile passed with the -D option in
> order to redirect stderr to it instead of /dev/null.
> 
> Also remove some unused code in log.h.
> 
> Signed-off-by: Dimitris Aragiorgis <dim...@arrikto.com>
> Message-Id: <1455795518-19205-1-git-send-email-dim...@arrikto.com>
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> ---
>  include/qemu/log.h |  6 ------
>  os-posix.c         |  6 +++++-
>  util/log.c         | 11 +++++++++--
>  3 files changed, 14 insertions(+), 9 deletions(-)
> 
> diff --git a/include/qemu/log.h b/include/qemu/log.h
> index 30817f7..dda65fd 100644
> --- a/include/qemu/log.h
> +++ b/include/qemu/log.h
> @@ -94,12 +94,6 @@ static inline void qemu_log_close(void)
>      }
>  }
>  
> -/* Set up a new log file */
> -static inline void qemu_log_set_file(FILE *f)
> -{
> -    qemu_logfile = f;
> -}
> -
>  /* define log items */
>  typedef struct QEMULogItem {
>      int mask;
> diff --git a/os-posix.c b/os-posix.c
> index cce62ed..92fa3ba 100644
> --- a/os-posix.c
> +++ b/os-posix.c
> @@ -37,6 +37,7 @@
>  #include "qemu-options.h"
>  #include "qemu/rcu.h"
>  #include "qemu/error-report.h"
> +#include "qemu/log.h"
>  
>  #ifdef CONFIG_LINUX
>  #include <sys/prctl.h>
> @@ -275,7 +276,10 @@ void os_setup_post(void)
>  
>          dup2(fd, 0);
>          dup2(fd, 1);
> -        dup2(fd, 2);
> +        /* In case -D is given do not redirect stderr to /dev/null */
> +        if (!qemu_logfile) {
> +            dup2(fd, 2);
> +        }
> 

This hunk broke qemu usage in libvirt. When libvirtd runs qemu for
capability probing, it just hangs.

There is no -D on the command line:

qemu-system-x86_64 -S -no-user-config -nodefaults -nographic -M none
 -qmp unix:/var/lib/libvirt/qemu/capabilities.monitor.sock,server,nowait
 -pidfile /var/lib/libvirt/qemu/capabilities.pidfile -daemonize

Jan

Reply via email to