From: Wilfried Goesgens Date: Thu, 14 Jun 2012 22:04:27 +0000 (+0200) Subject: cmd_read(): fseek just returns 0 on success, not the current offset. X-Git-Tag: v8.12~11 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=dffda67a173a9b3acd45501f537010070ae8861a cmd_read(): fseek just returns 0 on success, not the current offset. --- 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);