From c25d7890e7b2fc87cce8804851587db805485358 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 8 Sep 2011 08:25:48 +0000 Subject: Cope with zero-length files svn path=/trunk/netsurf/; revision=12777 --- content/fetchers/file.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'content/fetchers') diff --git a/content/fetchers/file.c b/content/fetchers/file.c index 9cdc21054..164fa5fd9 100644 --- a/content/fetchers/file.c +++ b/content/fetchers/file.c @@ -304,7 +304,7 @@ static void fetch_file_process_plain(struct fetch_file_context *ctx, goto fetch_file_process_aborted; /* main data loop */ - do { + while (tot_read < fdstat->st_size) { res = read(fd, buf, buf_size); if (res == -1) { fetch_file_send_callback(FETCH_ERROR, ctx, @@ -325,8 +325,7 @@ static void fetch_file_process_plain(struct fetch_file_context *ctx, if (fetch_file_send_callback(FETCH_DATA, ctx, buf, res, FETCH_ERROR_NO_ERROR)) break; - - } while (tot_read < fdstat->st_size); + } if (ctx->aborted == false) fetch_file_send_callback(FETCH_FINISHED, ctx, 0, 0, -- cgit v1.2.3