Skip to content
  • Markus Armbruster's avatar
    daa76aa4
    log: Fix qemu_set_log_filename() error handling · daa76aa4
    Markus Armbruster authored
    
    
    When qemu_set_log_filename() detects an invalid file name, it reports
    an error, closes the log file (if any), and starts logging to stderr
    (unless daemonized or nothing is being logged).
    
    This is wrong.  Asking for an invalid log file on the command line
    should be fatal.  Asking for one in the monitor should fail without
    messing up an existing logfile.
    
    Fix by converting qemu_set_log_filename() to Error.  Pass it
    &error_fatal, except for hmp_logfile report errors.
    
    This also permits testing without a subprocess, so do that.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1466011636-6112-4-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    daa76aa4
    log: Fix qemu_set_log_filename() error handling
    Markus Armbruster authored
    
    
    When qemu_set_log_filename() detects an invalid file name, it reports
    an error, closes the log file (if any), and starts logging to stderr
    (unless daemonized or nothing is being logged).
    
    This is wrong.  Asking for an invalid log file on the command line
    should be fatal.  Asking for one in the monitor should fail without
    messing up an existing logfile.
    
    Fix by converting qemu_set_log_filename() to Error.  Pass it
    &error_fatal, except for hmp_logfile report errors.
    
    This also permits testing without a subprocess, so do that.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1466011636-6112-4-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Loading