diff options
-rw-r--r-- | slice.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -34,7 +34,7 @@ int main(int argc, char **argv) { bytes_end += seekpos; } - if (bytes_end <= seekpos) { + if (bytes_end < seekpos) { fprintf(stderr, "The last byte must be greater than the first byte.\n"); return 1; } @@ -60,6 +60,7 @@ int main(int argc, char **argv) { if (bytes_end - read_bytes < read_count) read_count = bytes_end - read_bytes; + /* if fseek failed, discard some bytes */ if (read_bytes < seekpos) skip_bytes = seekpos - read_bytes; |