cmd_read(): fseek just returns 0 on success, not the current offset.
authorWilfried Goesgens <dothebart@citadel.org>
Thu, 14 Jun 2012 22:04:27 +0000 (00:04 +0200)
committerWilfried Goesgens <dothebart@citadel.org>
Thu, 14 Jun 2012 22:04:27 +0000 (00:04 +0200)
citadel/file_ops.c

index 75670266b73d9a5aec9382d4ab9f18de5840b43c..a3e8d749859590c8ea035e51a59f9ab010ea71b0 100644 (file)
@@ -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);