From dffda67a173a9b3acd45501f537010070ae8861a Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Fri, 15 Jun 2012 00:04:27 +0200 Subject: [PATCH] cmd_read(): fseek just returns 0 on success, not the current offset. --- citadel/file_ops.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/citadel/file_ops.c b/citadel/file_ops.c index 75670266b..a3e8d7498 100644 --- a/citadel/file_ops.c +++ b/citadel/file_ops.c @@ -610,8 +610,13 @@ void cmd_read(char *cmdbuf) } rc = fseek(CC->download_fp, start_pos, 0); - if (rc != start_pos) { + if (rc < 0) { cprintf("%d your file is smaller then %ld.\n", ERROR + ILLEGAL_VALUE, start_pos); + syslog(LOG_ALERT, "your file %s is smaller then %ld. [%s]\n", + CC->upl_path, + start_pos, + strerror(errno)); + return; } bytes = fread(buf, 1, bytes, CC->download_fp); -- 2.30.2