aboutsummaryrefslogtreecommitdiff
path: root/libmpio
diff options
context:
space:
mode:
authorgermeier <germeier>2002-09-13 17:01:32 +0000
committergermeier <germeier>2002-09-13 17:01:32 +0000
commit0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf (patch)
treeced72ea2bddc140a20cef04d861e93219cae5aeb /libmpio
parentb10e3b7730109f824575b45ba38b8f95520add02 (diff)
downloadmpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.tar.gz
mpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.tar.bz2
mpiosh-0dd441fe0f1942a3bd8e21339f331c63ed9e7ecf.zip
fixed abort handling in mpio_file_put
Diffstat (limited to 'libmpio')
-rw-r--r--libmpio/mpio.c24
1 files changed, 18 insertions, 6 deletions
diff --git a/libmpio/mpio.c b/libmpio/mpio.c
index e61c782..b32dee6 100644
--- a/libmpio/mpio.c
+++ b/libmpio/mpio.c
@@ -1,6 +1,6 @@
/*
*
- * $Id: mpio.c,v 1.13 2002/09/13 13:07:05 germeier Exp $
+ * $Id: mpio.c,v 1.14 2002/09/13 17:01:34 germeier Exp $
*
* Library for USB MPIO-*
*
@@ -307,6 +307,8 @@ mpio_file_get(mpio_t *m, mpio_mem_t mem, BYTE *filename,
if (progress_callback)
abort=(*progress_callback)((fsize-filesize), fsize);
+ if (abort)
+ debug("aborting operation\n");
} while ((mpio_fatentry_next_entry(m, mem, f) && (filesize>0)) &&
(!abort));
@@ -459,26 +461,36 @@ mpio_file_put(mpio_t *m, mpio_mem_t mem, BYTE *filename,
close(fd);
- if (progress_callback)
- abort=(*progress_callback)((fsize-filesize), fsize);
-
if (abort)
{ /* delete the just written blocks, because the user
* aborted the operation
*/
+ debug("aborting operation\n");
+ debug("removing already written blocks\n");
+
+ filesize=fsize;
memcpy(&current, &firstblock, sizeof(mpio_fatentry_t));
memcpy(&backup, &firstblock, sizeof(mpio_fatentry_t));
-
+
while (mpio_fatentry_next_entry(m, mem, &current))
{
mpio_io_block_delete(m, mem, &backup);
mpio_fatentry_set_free(m, mem, &backup);
memcpy(&backup, &current, sizeof(mpio_fatentry_t));
+
+ if (filesize > BLOCK_SIZE)
+ {
+ filesize -= BLOCK_SIZE;
+ } else {
+ filesize -= filesize;
+ }
+
+ if (progress_callback)
+ (*progress_callback)((fsize-filesize), fsize);
}
mpio_io_block_delete(m, mem, &backup);
mpio_fatentry_set_free(m, mem, &backup);
-
} else {
mpio_dentry_put(m, mem,
filename, strlen(filename),