judge read_bytes > 0

pull/56/merge
yuqing 2017-03-08 15:57:30 +08:00
parent fa8331340f
commit 51e9da9a77
1 changed files with 19 additions and 16 deletions

View File

@ -1992,24 +1992,27 @@ static int tracker_deal_get_one_sys_file(struct fast_task_info *pTask)
long2buff(file_stat.st_size, p);
p += FDFS_PROTO_PKG_LEN_SIZE;
bytes = read_bytes + 1;
if (read_bytes > 0 && (result=getFileContentEx(full_filename, \
p, offset, &bytes)) != 0)
{
pTask->length = sizeof(TrackerHeader);
return result;
}
if (read_bytes > 0)
{
bytes = read_bytes + 1;
if ((result=getFileContentEx(full_filename, \
p, offset, &bytes)) != 0)
{
pTask->length = sizeof(TrackerHeader);
return result;
}
if (bytes != read_bytes)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, read bytes: %"PRId64
" != expect bytes: %"PRId64, \
__LINE__, pTask->client_ip, bytes, read_bytes);
if (bytes != read_bytes)
{
logError("file: "__FILE__", line: %d, " \
"client ip: %s, read bytes: %"PRId64
" != expect bytes: %"PRId64, \
__LINE__, pTask->client_ip, bytes, read_bytes);
pTask->length = sizeof(TrackerHeader);
return EIO;
}
pTask->length = sizeof(TrackerHeader);
return EIO;
}
}
p += read_bytes;
pTask->length = p - pTask->data;