}
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);
wcsession *WCC = WC;
size_t bytes_read = 0;
size_t this_block = 0;
- int rc;
+ int rc = 6;
+ int ServerRc = 6;
if (Ret == NULL) {
return -1;
}
- while (bytes_read < total_len) {
+ while ((bytes_read < total_len) && (ServerRc == 6)) {
if (WCC->serv_sock==-1) {
FlushStrBuf(Ret);
}
serv_printf("READ "SIZE_T_FMT"|"SIZE_T_FMT, bytes_read, total_len-bytes_read);
- if ( (rc = StrBuf_ServGetln(Buf) > 0) && (GetServerStatus(Buf, NULL) == 6) )
+ if ( (rc = StrBuf_ServGetln(Buf) > 0) &&
+ (ServerRc = GetServerStatus(Buf, NULL), ServerRc == 6) )
{
if (rc < 0)
return rc;