qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] hw/core/loader: Fixup whitespace for get_image_size()
@ 2025-10-30  1:53 alistair23
  2025-10-30  1:53 ` [PATCH 2/3] hw/core/loader: Free the image file descriptor on error alistair23
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: alistair23 @ 2025-10-30  1:53 UTC (permalink / raw)
  To: philmd, alistair.francis, vishalc, qemu-devel; +Cc: alistair23

From: Alistair Francis <alistair.francis@wdc.com>

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
---
 hw/core/loader.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/hw/core/loader.c b/hw/core/loader.c
index 590c5b02aa..73564a2a46 100644
--- a/hw/core/loader.c
+++ b/hw/core/loader.c
@@ -75,14 +75,20 @@ int64_t get_image_size(const char *filename, Error **errp)
 {
     int fd;
     int64_t size;
+
     fd = qemu_open(filename, O_RDONLY | O_BINARY, errp);
-    if (fd < 0)
+
+    if (fd < 0) {
         return -1;
+    }
+
     size = lseek(fd, 0, SEEK_END);
+
     if (size < 0) {
         error_setg_errno(errp, errno, "lseek failure: %s", filename);
         return -1;
     }
+
     close(fd);
     return size;
 }
-- 
2.51.0



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2025-10-31  1:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-30  1:53 [PATCH 1/3] hw/core/loader: Fixup whitespace for get_image_size() alistair23
2025-10-30  1:53 ` [PATCH 2/3] hw/core/loader: Free the image file descriptor on error alistair23
2025-10-30  8:24   ` Philippe Mathieu-Daudé
2025-10-30  8:27   ` Vishal Chourasia
2025-10-30  1:53 ` [PATCH 3/3] hw/core/loader: Free the allocated string from size_to_str() alistair23
2025-10-30  8:26   ` Philippe Mathieu-Daudé
2025-10-31  1:10   ` Alistair Francis
2025-10-30  8:23 ` [PATCH 1/3] hw/core/loader: Fixup whitespace for get_image_size() Vishal Chourasia
2025-10-30  8:26 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).