[PATCH 1/3] scripts: common: fix pread_full() for windows
Maud Spierings via B4 Relay
devnull+maudspierings.gocontroll.com at kernel.org
Fri Nov 28 06:08:52 PST 2025
From: Maud Spierings <maudspierings at gocontroll.com>
pread() is not available for windows, convert to lseek() + read()
Signed-off-by: Maud Spierings <maudspierings at gocontroll.com>
---
I think this modifies the state of fd, I am not sure if pread() did this
too. May be necessary to point the file pointer where it was before? On
the other hand this reads the whole file so why.
---
scripts/common.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/scripts/common.c b/scripts/common.c
index a6eee968b7..544d295b7f 100644
--- a/scripts/common.c
+++ b/scripts/common.c
@@ -202,8 +202,12 @@ int pread_full(int fd, void *buf, size_t size, loff_t offset)
size_t insize = size;
int now;
+ now = lseek(fd, offset, SEEK_SET);
+ if (now < 0)
+ return now;
+
while (size) {
- now = pread(fd, buf, size, offset);
+ now = read(fd, buf, size);
if (now == 0)
break;
if (now < 0)
--
2.52.0
More information about the barebox
mailing list