summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-08-20 10:08:08 +0000
committerdrath <drath@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2007-08-20 10:08:08 +0000
commit222c05c92407a4d36ec2406c007d46f12f12a24d (patch)
tree7a5913b5a4a76dcd92609ed5bb7c8493cf45a5cd
parent0eb8621bf2a27191fbfb66159a0927ab6820800f (diff)
downloadopenocd_libswd-222c05c92407a4d36ec2406c007d46f12f12a24d.tar.gz
openocd_libswd-222c05c92407a4d36ec2406c007d46f12f12a24d.tar.bz2
openocd_libswd-222c05c92407a4d36ec2406c007d46f12f12a24d.tar.xz
openocd_libswd-222c05c92407a4d36ec2406c007d46f12f12a24d.zip
- update file size when writing to a fileio
git-svn-id: svn://svn.berlios.de/openocd/trunk@199 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r--src/helper/fileio.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/helper/fileio.c b/src/helper/fileio.c
index 742bc689..b0ad446e 100644
--- a/src/helper/fileio.c
+++ b/src/helper/fileio.c
@@ -295,16 +295,22 @@ int fileio_local_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written
int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written)
{
+ int retval;
+
switch (fileio->location)
{
case FILEIO_LOCAL:
- return fileio_local_write(fileio, size, buffer, size_written);
+ retval = fileio_local_write(fileio, size, buffer, size_written);
break;
default:
ERROR("BUG: should never get here");
+ exit(-1);
}
- return ERROR_OK;
+ if (retval == ERROR_OK)
+ fileio->size += *size_written;
+
+ return retval;;
}
int fileio_write_u32(fileio_t *fileio, u32 data)