Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LgllB-0004zb-UI for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:38 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LgllA-0004xi-Ae for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:36 -0400 Received: from [199.232.76.173] (port=35997 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LgllA-0004xX-74 for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:36 -0400 Received: from mx20.gnu.org ([199.232.41.8]:2558) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Lgll9-0006ov-Uo for qemu-devel@nongnu.org; Mon, 09 Mar 2009 16:07:35 -0400 Received: from savannah.gnu.org ([199.232.41.3] helo=sv.gnu.org) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1LgjvJ-0008QP-1J for qemu-devel@nongnu.org; Mon, 09 Mar 2009 14:09:57 -0400 Received: from cvs.savannah.gnu.org ([199.232.41.69]) by sv.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1LgjuK-0006jh-To for qemu-devel@nongnu.org; Mon, 09 Mar 2009 18:08:56 +0000 Received: from blueswir1 by cvs.savannah.gnu.org with local (Exim 4.69) (envelope-from ) id 1LgjuK-0006jd-Ll for qemu-devel@nongnu.org; Mon, 09 Mar 2009 18:08:56 +0000 MIME-Version: 1.0 Errors-To: blueswir1 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Blue Swirl Message-Id: Date: Mon, 09 Mar 2009 18:08:56 +0000 Subject: [Qemu-devel] [6792] fread_targphys(): Do not cut off the tail. Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 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; }