util: use qemu_create() in qemu_write_pidfile()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 20 Apr 2022 13:26:20 +0000 (17:26 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 21 Apr 2022 13:09:09 +0000 (17:09 +0400)
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>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-38-marcandre.lureau@redhat.com>

util/oslib-posix.c

index 9751bc6be9d7a2e305a572f5b2e8a46ee976085c..bcb35c3c824670dac49a154ff588b48b8c90b6c9 100644 (file)
@@ -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;
         }