projects
/
citadel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0af8576
)
* partialy revert r8246; we're working in units of one here, so the number of units...
author
Wilfried Göesgens
<willi@citadel.org>
Mon, 1 Feb 2010 19:19:34 +0000
(19:19 +0000)
committer
Wilfried Göesgens
<willi@citadel.org>
Mon, 1 Feb 2010 19:19:34 +0000
(19:19 +0000)
citadel/file_ops.c
patch
|
blob
|
history
diff --git
a/citadel/file_ops.c
b/citadel/file_ops.c
index b7b0cb3f32c5935f0d4af095918b3e7acee3db65..ced5a31d568c3fef6f83466c7e51313abfdd4fbc 100644
(file)
--- 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 {