From: Vishal Chourasia <vishalc@linux.ibm.com>
To: adityag@linux.ibm.com, harshpb@linux.ibm.com,
milesg@linux.ibm.com, npiggin@gmail.com,
peter.maydell@linaro.org, alistair23@gmail.com,
balaton@eik.bme.hu, qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
berrange@redhat.com
Cc: Vishal Chourasia <vishalc@linux.ibm.com>
Subject: [Patch v8 1/5] core/loader: Use qemu_open() instead of open() in get_image_size()
Date: Fri, 24 Oct 2025 10:57:03 +0530 [thread overview]
Message-ID: <20251024052707.1852358-2-vishalc@linux.ibm.com> (raw)
In-Reply-To: <20251024052707.1852358-1-vishalc@linux.ibm.com>
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é <berrange@redhat.com>
Signed-off-by: Vishal Chourasia <vishalc@linux.ibm.com>
---
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.51.0
next prev parent reply other threads:[~2025-10-24 5:28 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 5:27 [Patch v8 0/5] core/loader: capture Error from load_image_targphys Vishal Chourasia
2025-10-24 5:27 ` Vishal Chourasia [this message]
2025-10-24 5:27 ` [Patch v8 2/5] " Vishal Chourasia
2025-10-24 7:09 ` Philippe Mathieu-Daudé
2025-10-24 5:27 ` [Patch v8 3/5] core/loader: add check for zero size in load_image_targphys_as Vishal Chourasia
2025-10-24 5:27 ` [Patch v8 4/5] core: Pass errp to load_image_targphys_as() Vishal Chourasia
2025-10-24 5:27 ` [Patch v8 5/5] ppc: Pass error_fatal to load_image_targphys() Vishal Chourasia
2025-10-24 7:00 ` Aditya Gupta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251024052707.1852358-2-vishalc@linux.ibm.com \
--to=vishalc@linux.ibm.com \
--cc=adityag@linux.ibm.com \
--cc=alistair23@gmail.com \
--cc=balaton@eik.bme.hu \
--cc=berrange@redhat.com \
--cc=harshpb@linux.ibm.com \
--cc=milesg@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).