From: Maud Spierings <[email protected]> pread() is not available for windows, convert to lseek() + read()
Signed-off-by: Maud Spierings <[email protected]> --- 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
