r1148 - trunk/src/host/dfu-util/src

werner at sita.openmoko.org werner at sita.openmoko.org
Tue Feb 27 14:24:40 CET 2007


Author: werner
Date: 2007-02-27 14:24:30 +0100 (Tue, 27 Feb 2007)
New Revision: 1148

Modified:
   trunk/src/host/dfu-util/src/sam7dfu.c
Log:
sam7dfu.c (sam7dfu_do_upload): initialize total_bytes to zero
sam7dfu.c (sam7dfu_do_upload): set "ret" to total_bytes on short write



Modified: trunk/src/host/dfu-util/src/sam7dfu.c
===================================================================
--- trunk/src/host/dfu-util/src/sam7dfu.c	2007-02-27 08:37:06 UTC (rev 1147)
+++ trunk/src/host/dfu-util/src/sam7dfu.c	2007-02-27 13:24:30 UTC (rev 1148)
@@ -18,7 +18,7 @@
 int sam7dfu_do_upload(struct usb_dev_handle *usb_handle, int interface, 
 		      int xfer_size, const char *fname)
 {
-	int ret, fd, total_bytes;
+	int ret, fd, total_bytes = 0;
 	char *buf = malloc(xfer_size);
 
 	if (!buf)
@@ -41,6 +41,7 @@
 		if (write_rc < rc) {
 			fprintf(stderr, "Short write: %s\n",
 				strerror(errno));
+			ret = total_bytes;
 			goto out_close;
 		}
 		total_bytes += rc;





More information about the commitlog mailing list