Skip to content
  • Markus Armbruster's avatar
    bd6fee9f
    log: Fix qemu_set_dfilter_ranges() error reporting · bd6fee9f
    Markus Armbruster authored
    
    
    g_error() is not an acceptable way to report errors to the user:
    
        $ qemu-system-x86_64 -dfilter 1000+0
    
        ** (process:17187): ERROR **: Failed to parse range in: 1000+0
        Trace/breakpoint trap (core dumped)
    
    g_assert() isn't, either:
    
        $ qemu-system-x86_64 -dfilter 1000x+64
        **
        ERROR:/work/armbru/qemu/util/log.c:180:qemu_set_dfilter_ranges: assertion failed: (e == range_op)
        Aborted (core dumped)
    
    Convert qemu_set_dfilter_ranges() to Error.  Rework its deeply nested
    control flow.  Touch up the error messages.  Call it with
    &error_fatal.
    
    This also permits testing without a subprocess, so do that.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1466011636-6112-3-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    bd6fee9f
    log: Fix qemu_set_dfilter_ranges() error reporting
    Markus Armbruster authored
    
    
    g_error() is not an acceptable way to report errors to the user:
    
        $ qemu-system-x86_64 -dfilter 1000+0
    
        ** (process:17187): ERROR **: Failed to parse range in: 1000+0
        Trace/breakpoint trap (core dumped)
    
    g_assert() isn't, either:
    
        $ qemu-system-x86_64 -dfilter 1000x+64
        **
        ERROR:/work/armbru/qemu/util/log.c:180:qemu_set_dfilter_ranges: assertion failed: (e == range_op)
        Aborted (core dumped)
    
    Convert qemu_set_dfilter_ranges() to Error.  Rework its deeply nested
    control flow.  Touch up the error messages.  Call it with
    &error_fatal.
    
    This also permits testing without a subprocess, so do that.
    
    Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
    Message-Id: <1466011636-6112-3-git-send-email-armbru@redhat.com>
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
Loading