]> git.proxmox.com Git - mirror_qemu.git/commit
block/file-posix: fix g_file_get_contents return path
authorSam Li <faithilikerun@gmail.com>
Thu, 27 Jul 2023 11:58:44 +0000 (19:58 +0800)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 27 Jul 2023 13:46:09 +0000 (09:46 -0400)
commit29a242e165610df9b158bdb8d6b84e83d8733fc4
tree1dd81f35bad280d11b7f43445919343c21b8ea79
parenta5942c177b7bcc1357e496b7d68668befcfc2bb9
block/file-posix: fix g_file_get_contents return path

The g_file_get_contents() function returns a g_boolean. If it fails, the
returned value will be 0 instead of -1. Solve the issue by skipping
assigning ret value.

This issue was found by Matthew Rosato using virtio-blk-{pci,ccw} backed
by an NVMe partition e.g. /dev/nvme0n1p1 on s390x.

Signed-off-by: Sam Li <faithilikerun@gmail.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-id: 20230727115844.8480-1-faithilikerun@gmail.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/file-posix.c