summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands/crc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/commands/crc.c b/commands/crc.c
index 09af6aa3f9..8f80e424fd 100644
--- a/commands/crc.c
+++ b/commands/crc.c
@@ -47,9 +47,12 @@ static int file_crc(char* filename, ulong start, ulong size, ulong *crc,
}
if (start > 0) {
- ret = lseek(fd, start, SEEK_SET);
- if (ret == -1) {
+ off_t lseek_ret;
+ errno = 0;
+ lseek_ret = lseek(fd, start, SEEK_SET);
+ if (lseek_ret == (off_t)-1 && errno) {
perror("lseek");
+ ret = -1;
goto out;
}
}