From 20cc047f29769e8716c7969748d461c07e6c55ec Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 7 Dec 2009 21:37:15 +0100 Subject: [PATCH] monitor: convert do_getfd() to QError Signed-off-by: Markus Armbruster Signed-off-by: Anthony Liguori --- monitor.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/monitor.c b/monitor.c index 91cb2ce..16d611e 100644 --- a/monitor.c +++ b/monitor.c @@ -2071,19 +2071,21 @@ static void do_getfd(Monitor *mon, const QDict *qdict, QObject **ret_data) fd = qemu_chr_get_msgfd(mon->chr); if (fd == -1) { - monitor_printf(mon, "getfd: no file descriptor supplied via SCM_RIGHTS\n"); + qemu_error_new(QERR_FD_NOT_SUPPLIED); return; } if (qemu_isdigit(fdname[0])) { - monitor_printf(mon, "getfd: monitor names may not begin with a number\n"); + qemu_error_new(QERR_INVALID_PARAMETER, "fdname"); return; } fd = dup(fd); if (fd == -1) { - monitor_printf(mon, "Failed to dup() file descriptor: %s\n", - strerror(errno)); + if (errno == EMFILE) + qemu_error_new(QERR_TOO_MANY_FILES); + else + qemu_error_new(QERR_UNDEFINED_ERROR); return; } -- 2.7.4