util: use qemu_write_full() in qemu_write_pidfile()
authorMarc-André Lureau <marcandre.lureau@redhat.com>
Wed, 20 Apr 2022 13:26:19 +0000 (17:26 +0400)
committerMarc-André Lureau <marcandre.lureau@redhat.com>
Thu, 21 Apr 2022 13:09:09 +0000 (17:09 +0400)
Mostly for correctness.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20220420132624.2439741-37-marcandre.lureau@redhat.com>

util/oslib-posix.c

index fd2bdc9ac7b37cf80dce3ffa05419143feea3a99..9751bc6be9d7a2e305a572f5b2e8a46ee976085c 100644 (file)
@@ -184,7 +184,7 @@ bool qemu_write_pidfile(const char *path, Error **errp)
     }
 
     snprintf(pidstr, sizeof(pidstr), FMT_pid "\n", getpid());
-    if (write(fd, pidstr, strlen(pidstr)) != strlen(pidstr)) {
+    if (qemu_write_full(fd, pidstr, strlen(pidstr)) != strlen(pidstr)) {
         error_setg(errp, "Failed to write pid file");
         goto fail_unlink;
     }