From 77a5b02b5b3a3053414560737a41151005623b50 Mon Sep 17 00:00:00 2001 From: Vishal Chourasia Date: Fri, 24 Oct 2025 18:35:53 +0530 Subject: [PATCH] hw/core/loader: Use qemu_open() instead of open() in get_image_size() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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é --- hw/core/loader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3