aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_publish.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-09-11 22:45:57 +0000
committerChristian Grothoff <christian@grothoff.org>2013-09-11 22:45:57 +0000
commite695e63169a4d0da7ab2fe77c59ac2ca29e443d1 (patch)
treec6dab890be90cc16258a76b77ec71533af49bcee /src/fs/fs_publish.c
parente0bf5085a192fe5e9ba401ea7bc62f304c370c4d (diff)
downloadgnunet-e695e63169a4d0da7ab2fe77c59ac2ca29e443d1.tar.gz
gnunet-e695e63169a4d0da7ab2fe77c59ac2ca29e443d1.zip
-do not clean up reader more than once
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r--src/fs/fs_publish.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c
index 1ed37d7e4..9483ec36a 100644
--- a/src/fs/fs_publish.c
+++ b/src/fs/fs_publish.c
@@ -349,7 +349,7 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
349 const char *dd; 349 const char *dd;
350 350
351 p = pc->fi_pos; 351 p = pc->fi_pos;
352 if (p->is_directory == GNUNET_YES) 352 if (GNUNET_YES == p->is_directory)
353 { 353 {
354 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset); 354 pt_size = GNUNET_MIN (max, p->data.dir.dir_size - offset);
355 dd = p->data.dir.dir_data; 355 dd = p->data.dir.dir_data;
@@ -357,8 +357,16 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg)
357 } 357 }
358 else 358 else
359 { 359 {
360 if (UINT64_MAX == offset) 360 if (UINT64_MAX == offset)
361 return p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); 361 {
362 if (NULL != p->data.file.reader)
363 {
364 pt_size = p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL);
365 p->data.file.reader = NULL;
366 return pt_size;
367 }
368 return 0;
369 }
362 pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); 370 pt_size = GNUNET_MIN (max, p->data.file.file_size - offset);
363 if (pt_size == 0) 371 if (pt_size == 0)
364 return 0; /* calling reader with pt_size==0 372 return 0; /* calling reader with pt_size==0