From patchwork Fri Mar 8 09:48:33 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 226067 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 35F492C038C for ; Fri, 8 Mar 2013 20:51:30 +1100 (EST) Received: from localhost ([::1]:54106 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDtxY-0002Eg-F4 for incoming@patchwork.ozlabs.org; Fri, 08 Mar 2013 04:51:28 -0500 Received: from eggs.gnu.org ([208.118.235.92]:54226) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDtwz-0002B0-8h for qemu-devel@nongnu.org; Fri, 08 Mar 2013 04:50:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDtww-0000f9-35 for qemu-devel@nongnu.org; Fri, 08 Mar 2013 04:50:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:30885) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDtwv-0000f0-RG for qemu-devel@nongnu.org; Fri, 08 Mar 2013 04:50:50 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r289mgXw031850 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 8 Mar 2013 04:48:43 -0500 Received: from localhost (ovpn-112-36.ams2.redhat.com [10.36.112.36]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r289mfvY024175; Fri, 8 Mar 2013 04:48:42 -0500 From: Stefan Hajnoczi To: Date: Fri, 8 Mar 2013 10:48:33 +0100 Message-Id: <1362736116-31460-3-git-send-email-stefanha@redhat.com> In-Reply-To: <1362736116-31460-1-git-send-email-stefanha@redhat.com> References: <1362736116-31460-1-git-send-email-stefanha@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: Anthony Liguori , Stefan Hajnoczi , Stefan Berger Subject: [Qemu-devel] [PATCH 2/5] rng-random: Use qemu_open / qemu_close X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Stefan Berger In the rng backend use qemu_open and qemu_close rather than POSIX open/close. Signed-off-by: Stefan Berger Reviewed-by: Eric Blake Signed-off-by: Stefan Hajnoczi --- backends/rng-random.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backends/rng-random.c b/backends/rng-random.c index 0d11088..acd20af 100644 --- a/backends/rng-random.c +++ b/backends/rng-random.c @@ -74,7 +74,7 @@ static void rng_random_opened(RngBackend *b, Error **errp) error_set(errp, QERR_INVALID_PARAMETER_VALUE, "filename", "a valid filename"); } else { - s->fd = open(s->filename, O_RDONLY | O_NONBLOCK); + s->fd = qemu_open(s->filename, O_RDONLY | O_NONBLOCK); if (s->fd == -1) { error_set(errp, QERR_OPEN_FILE_FAILED, s->filename); @@ -130,7 +130,7 @@ static void rng_random_finalize(Object *obj) qemu_set_fd_handler(s->fd, NULL, NULL, NULL); if (s->fd != -1) { - close(s->fd); + qemu_close(s->fd); } g_free(s->filename);