xorg-x11-server/p_xorg_rom_read.diff

15 lines
548 B
Diff

--- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c.orig 2005-12-21 18:53:54.000000000 -0700
+++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c 2005-12-21 19:01:28.000000000 -0700
@@ -791,8 +791,10 @@
write(fd, "1", 2);
lseek(fd, 0, SEEK_SET);
+ len = min(Len, st.st_size);
+
/* copy the ROM until we hit Len, EOF or read error */
- for (i = 0; i < Len && read(fd, Buf, 1) > 0; Buf++, i++)
+ for (; len && (size = read(fd, Buf, len)) > 0 ; Buf+=size, len-=size)
;
write(fd, "0", 2);