From: Wilfried Göesgens Date: Mon, 1 Feb 2010 19:19:34 +0000 (+0000) Subject: * partialy revert r8246; we're working in units of one here, so the number of units... X-Git-Tag: v7.86~466 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=a7cc8d67bea4e489060d95b5a550b5358d85c389 * partialy revert r8246; we're working in units of one here, so the number of units read actualy _is_ the number of bytes read here. --- diff --git a/citadel/file_ops.c b/citadel/file_ops.c index b7b0cb3f3..ced5a31d5 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -621,6 +621,7 @@ void cmd_read(char *cmdbuf) { long start_pos; size_t bytes; + size_t actual_bytes; char *buf = NULL; start_pos = extract_long(cmdbuf, 0); @@ -636,8 +637,10 @@ void cmd_read(char *cmdbuf) buf = malloc(bytes + 1); fseek(CC->download_fp, start_pos, 0); - if (fread(buf, 1, bytes, CC->download_fp) == 1) { - cprintf("%d %d\n", BINARY_FOLLOWS, (int)bytes); + + actual_bytes = fread(buf, 1, bytes, CC->download_fp); + if (actual_bytes > 0) { + cprintf("%d %d\n", BINARY_FOLLOWS, (int)actual_bytes); client_write(buf, bytes); } else {