qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [6792] fread_targphys(): Do not cut off the tail.
@ 2009-03-09 18:08 Blue Swirl
  0 siblings, 0 replies; only message in thread
From: Blue Swirl @ 2009-03-09 18:08 UTC (permalink / raw)
  To: qemu-devel

Revision: 6792
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6792
Author:   blueswir1
Date:     2009-03-09 18:08:56 +0000 (Mon, 09 Mar 2009)
Log Message:
-----------
fread_targphys(): Do not cut off the tail.

loader.c:fread_targphys() read file by 4096 byte chunks and store them to
memory. But did not store the last chunk if its size was not 4096.

Signed-off-by: Takashi YOSHII <takasi-y@ops.dti.ne.jp>

Modified Paths:
--------------
    trunk/loader.c

Modified: trunk/loader.c
===================================================================
--- trunk/loader.c	2009-03-09 17:36:50 UTC (rev 6791)
+++ trunk/loader.c	2009-03-09 18:08:56 UTC (rev 6792)
@@ -90,11 +90,12 @@
     while (nbytes) {
 	want = nbytes > sizeof(buf) ? sizeof(buf) : nbytes;
 	did = fread(buf, 1, want, f);
-	if (did != want) break;
 
 	cpu_physical_memory_write_rom(dst_addr, buf, did);
 	dst_addr += did;
 	nbytes -= did;
+	if (did != want)
+	    break;
     }
     return dst_addr - dst_begin;
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-03-09 20:07 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-09 18:08 [Qemu-devel] [6792] fread_targphys(): Do not cut off the tail Blue Swirl

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).