From: Vishal Chourasia Date: Fri, 24 Oct 2025 13:05:53 +0000 (+0530) Subject: hw/core/loader: Use qemu_open() instead of open() in get_image_size() X-Git-Tag: v10.2.0-rc1~41^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77a5b02b5b3a3053414560737a41151005623b50;p=thirdparty%2Fqemu.git hw/core/loader: Use qemu_open() instead of open() in get_image_size() Replace open() with qemu_open() which provides better error handling via the Error object, automatically sets O_CLOEXEC, and supports FD passing with /dev/fdset. Currently pass errp argument as NULL. Suggested-by: Daniel P. Berrangé Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Vishal Chourasia Message-ID: <20251024130556.1942835-4-vishalc@linux.ibm.com> Signed-off-by: Philippe Mathieu-Daudé --- diff --git a/hw/core/loader.c b/hw/core/loader.c index 477661a025..c9782d67e8 100644 --- a/hw/core/loader.c +++ b/hw/core/loader.c @@ -74,7 +74,7 @@ int64_t get_image_size(const char *filename) { int fd; int64_t size; - fd = open(filename, O_RDONLY | O_BINARY); + fd = qemu_open(filename, O_RDONLY | O_BINARY, NULL); if (fd < 0) return -1; size = lseek(fd, 0, SEEK_END);