Received: from eggs.gnu.org ([2001:4830:134:3::10]:46891) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1byfbz-0004PU-R6 for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1byfbz-0006ZY-6L for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:23 -0400 Received: from mail-wm0-x242.google.com ([2a00:1450:400c:c09::242]:34352) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1byfbz-0006ZG-03 for qemu-devel@nongnu.org; Mon, 24 Oct 2016 09:48:23 -0400 Received: by mail-wm0-x242.google.com with SMTP id d199so9948034wmd.1 for ; Mon, 24 Oct 2016 06:48:22 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Mon, 24 Oct 2016 15:47:18 +0200 Message-Id: <1477316855-42218-34-git-send-email-pbonzini@redhat.com> In-Reply-To: <1477316855-42218-1-git-send-email-pbonzini@redhat.com> References: <1477316855-42218-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 33/50] colo: claim in find_and_check_chardev List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= From: Marc-André Lureau This factors out claiming of chardev, and changes the call to non-fatal to return an error like the rest of the chardev checks. Signed-off-by: Marc-André Lureau Message-Id: <20161022095318.17775-15-marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini --- net/colo-compare.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/net/colo-compare.c b/net/colo-compare.c index efcd15e..b115465 100644 --- a/net/colo-compare.c +++ b/net/colo-compare.c @@ -589,6 +589,13 @@ static int find_and_check_chardev(CharDriverState **chr, chr_name); return 1; } + + if (qemu_chr_fe_claim(*chr) < 0) { + error_setg(errp, "chardev \"%s\" cannot be claimed", + chr_name); + return 1; + } + return 0; } @@ -646,12 +653,6 @@ static void colo_compare_complete(UserCreatable *uc, Error **errp) return; } - qemu_chr_fe_claim_no_fail(s->chr_pri_in.chr); - - qemu_chr_fe_claim_no_fail(s->chr_sec_in.chr); - - qemu_chr_fe_claim_no_fail(s->chr_out.chr); - net_socket_rs_init(&s->pri_rs, compare_pri_rs_finalize); net_socket_rs_init(&s->sec_rs, compare_sec_rs_finalize); -- 1.8.3.1