Skip to content
  • Thomas Huth's avatar
    372a87a1
    Do not use %m in common code to print error messages · 372a87a1
    Thomas Huth authored
    
    
    The %m format specifier is an extension from glibc - and when compiling
    QEMU for NetBSD, the compiler correctly complains, e.g.:
    
    /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c: In function 'sigfd_handler':
    /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c:64:13: warning: %m is only
     allowed in syslog(3) like functions [-Wformat=]
                 printf("read from sigfd returned %zd: %m\n", len);
                 ^
    Let's use g_strerror() here instead, which is an easy-to-use wrapper
    around the thread-safe strerror_r() function.
    
    While we're at it, also convert the "printf()" in main-loop.c into
    the preferred "error_report()".
    
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    Message-Id: <20191018130716.25438-1-thuth@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    372a87a1
    Do not use %m in common code to print error messages
    Thomas Huth authored
    
    
    The %m format specifier is an extension from glibc - and when compiling
    QEMU for NetBSD, the compiler correctly complains, e.g.:
    
    /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c: In function 'sigfd_handler':
    /home/qemu/qemu-test.ELjfrQ/src/util/main-loop.c:64:13: warning: %m is only
     allowed in syslog(3) like functions [-Wformat=]
                 printf("read from sigfd returned %zd: %m\n", len);
                 ^
    Let's use g_strerror() here instead, which is an easy-to-use wrapper
    around the thread-safe strerror_r() function.
    
    While we're at it, also convert the "printf()" in main-loop.c into
    the preferred "error_report()".
    
    Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
    Message-Id: <20191018130716.25438-1-thuth@redhat.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading