tools/libxc: report malloc errors in writev_exact
authorOlaf Hering <olaf@aepfle.de>
Wed, 23 Sep 2020 06:48:40 +0000 (08:48 +0200)
committerIan Jackson <iwj@xenproject.org>
Mon, 9 Nov 2020 17:45:32 +0000 (17:45 +0000)
The caller of writev_exact should be notified about malloc errors
when dealing with partial writes.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wl@xen.org>
(cherry picked from commit 0d8d289af7a679c028462c4ed5d98586f9ef9648)

tools/libxc/xc_private.c

index 90974d572e27956268ee8e51b25bbafa05432f90..13a2c723c1f41ef4ab45ef6430ac445db6f9a689 100644 (file)
@@ -722,6 +722,7 @@ int writev_exact(int fd, const struct iovec *iov, int iovcnt)
                     if ( !local_iov )
                     {
                         saved_errno = ENOMEM;
+                        rc = -1;
                         goto out;
                     }