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é <[email protected]> Signed-off-by: Vishal Chourasia <[email protected]> --- 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
