Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> --- qemu-nbd.c | 30 +++++++++++++++++++++++++++++- 1 files changed, 29 insertions(+), 1 deletions(-)
diff --git a/qemu-nbd.c b/qemu-nbd.c index 972524d..573bf3d 100644 --- a/qemu-nbd.c +++ b/qemu-nbd.c @@ -23,7 +23,6 @@ #include <stdarg.h> #include <stdio.h> #include <getopt.h> -#include <err.h> #include <sys/wait.h> #include <sys/types.h> #include <sys/socket.h> @@ -78,6 +77,35 @@ static void version(const char *name) , name); } +static void err(int status, const char *format, ...) +{ + char *s, *msg; + va_list ap; + + msg = strerror(errno); + va_start(ap, format); + if (vasprintf(&s, format, ap) == -1) { + abort(); + } + fprintf(stderr, "qemu-nbd: %s: %s\n", s, msg); + free(s); + exit(status); +} + +static void errx(int status, const char *format, ...) +{ + char *s; + va_list ap; + + va_start(ap, format); + if (vasprintf(&s, format, ap) == -1) { + abort(); + } + fprintf(stderr, "qemu-nbd: %s\n", s); + free(s); + exit(status); +} + struct partition_record { uint8_t bootable; -- 1.7.6.4