Patchwork [Qemu-trivial] Use qemu_open / qemu_close in rng backend

login
register
mail settings
Submitter Stefan Hajnoczi
Date March 4, 2013, 10:56 a.m.
Message ID <20130304105610.GB2837@stefanha-thinkpad.redhat.com>
Download mbox | patch
Permalink /patch/224687/
State New
Headers show

Comments

Stefan Hajnoczi - March 4, 2013, 10:56 a.m.
This patch is fine but needs to be on qemu-devel@nongnu.org in addition
to qemu-trivial.

----- Forwarded message from Stefan Berger <stefanb@linux.vnet.ibm.com> -----

Date: Fri, 01 Mar 2013 07:53:55 -0500
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
To: qemu-trivial@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>, Eric Blake <eblake@redhat.com>
Subject: [Qemu-trivial] [PATCH] Use qemu_open / qemu_close in rng backend
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120911 Thunderbird/15.0.1

In the rng backend use qemu_open and qemu_close rather than POSIX
open/close.

Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com>




----- End forwarded message -----

Patch

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);