summaryrefslogtreecommitdiff
path: root/content/fetchers/file.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2011-09-08 08:25:48 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2011-09-08 08:25:48 +0000
commitc25d7890e7b2fc87cce8804851587db805485358 (patch)
treeca4ba8eeeb95a79a313d1a5e600242c0ba6d00a7 /content/fetchers/file.c
parent8e67ad805186d6495c98696658dbe06b015941e4 (diff)
downloadnetsurf-c25d7890e7b2fc87cce8804851587db805485358.tar.gz
netsurf-c25d7890e7b2fc87cce8804851587db805485358.tar.bz2
Cope with zero-length files
svn path=/trunk/netsurf/; revision=12777
Diffstat (limited to 'content/fetchers/file.c')
-rw-r--r--content/fetchers/file.c5
1 files changed, 2 insertions, 3 deletions
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,