}
if (td_read(td)) {
- if (!td->file_size || td->file_size > st.st_size)
+ if (!td->file_size || (st.st_size > td->file_size))
td->file_size = st.st_size;
} else {
if (!td->file_size)
return 1;
}
- if (!td->file_size || (td->file_size > bytes))
+ if (!td->file_size || (bytes > td->file_size))
td->file_size = bytes;
return 0;
return ret;
if (td->file_offset > td->file_size) {
- fprintf(stderr, "Client%d: offset larger than length\n", td->thread_number);
+ fprintf(stderr, "Client%d: offset larger than length (%Lu > %Lu)\n", td->thread_number, td->file_offset, td->file_size);
return 1;
}