diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-09-14 14:16:46 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-09-14 14:16:46 +0000 |
commit | dbaf8fc3075e00b95eaf8ced5a5d07d59ed61ca5 (patch) | |
tree | fb7108491625fcc61fdad42ceda6f6deb2f12473 /src/fs/fs_publish.c | |
parent | 264f8f3241199d433253b26837d10cf61d9b06fe (diff) | |
download | gnunet-dbaf8fc3075e00b95eaf8ced5a5d07d59ed61ca5.tar.gz gnunet-dbaf8fc3075e00b95eaf8ced5a5d07d59ed61ca5.zip |
-more complete fix for #3034
Diffstat (limited to 'src/fs/fs_publish.c')
-rw-r--r-- | src/fs/fs_publish.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index c554c8bb2..73af99ce9 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c | |||
@@ -345,8 +345,8 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
345 | { | 345 | { |
346 | struct GNUNET_FS_PublishContext *pc = cls; | 346 | struct GNUNET_FS_PublishContext *pc = cls; |
347 | struct GNUNET_FS_FileInformation *p; | 347 | struct GNUNET_FS_FileInformation *p; |
348 | size_t pt_size; | ||
349 | const char *dd; | 348 | const char *dd; |
349 | size_t pt_size; | ||
350 | 350 | ||
351 | p = pc->fi_pos; | 351 | p = pc->fi_pos; |
352 | if (GNUNET_YES == p->is_directory) | 352 | if (GNUNET_YES == p->is_directory) |
@@ -359,16 +359,15 @@ block_reader (void *cls, uint64_t offset, size_t max, void *buf, char **emsg) | |||
359 | { | 359 | { |
360 | if (UINT64_MAX == offset) | 360 | if (UINT64_MAX == offset) |
361 | { | 361 | { |
362 | if (NULL != p->data.file.reader) | 362 | if (&GNUNET_FS_data_reader_file_ == p->data.file.reader) |
363 | { | 363 | { |
364 | pt_size = p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); | 364 | /* force closing the file to avoid keeping too many files open */ |
365 | p->data.file.reader = NULL; | 365 | p->data.file.reader (p->data.file.reader_cls, offset, 0, NULL, NULL); |
366 | return pt_size; | ||
367 | } | 366 | } |
368 | return 0; | 367 | return 0; |
369 | } | 368 | } |
370 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); | 369 | pt_size = GNUNET_MIN (max, p->data.file.file_size - offset); |
371 | if (pt_size == 0) | 370 | if (0 == pt_size) |
372 | return 0; /* calling reader with pt_size==0 | 371 | return 0; /* calling reader with pt_size==0 |
373 | * might free buf, so don't! */ | 372 | * might free buf, so don't! */ |
374 | if (pt_size != | 373 | if (pt_size != |