diff mbox series

[37/41] util: use qemu_create() in qemu_write_pidfile()

Message ID 20220420132624.2439741-38-marcandre.lureau@redhat.com (mailing list archive)
State New, archived
Headers show
Series Misc cleanups | expand

Commit Message

Marc-André Lureau April 20, 2022, 1:26 p.m. UTC
From: Marc-André Lureau <marcandre.lureau@redhat.com>

qemu_open_old(O_CREATE) should be replaced with qemu_create() which
handles Error reporting.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
 util/oslib-posix.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Daniel P. Berrangé April 20, 2022, 3:50 p.m. UTC | #1
On Wed, Apr 20, 2022 at 05:26:20PM +0400, marcandre.lureau@redhat.com wrote:
> From: Marc-André Lureau <marcandre.lureau@redhat.com>
> 
> qemu_open_old(O_CREATE) should be replaced with qemu_create() which
> handles Error reporting.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  util/oslib-posix.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


With regards,
Daniel
diff mbox series

Patch

diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index e376f799b47e..ed8a2558b14d 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -138,9 +138,8 @@  bool qemu_write_pidfile(const char *path, Error **errp)
             .l_len = 0,
         };
 
-        fd = qemu_open_old(path, O_CREAT | O_WRONLY, S_IRUSR | S_IWUSR);
+        fd = qemu_create(path, O_WRONLY, S_IRUSR | S_IWUSR, errp);
         if (fd == -1) {
-            error_setg_errno(errp, errno, "Cannot open pid file");
             return false;
         }