Created attachment 204204 [details] fix-dd-noerror-lseek.diff Reporting 2 bugs in the same place. In the latest revision 341257 of 'dd.c', at https://svnweb.freebsd.org/base/head/bin/dd/dd.c?view=log , line 420, the error condition should be 'lseek(...) == -1'. The code: if (in.flags & ISSEEK && lseek(in.fd, (off_t)in.dbsz, SEEK_CUR)) should be: if (in.flags & ISSEEK && lseek(in.fd, (off_t)in.dbsz, SEEK_CUR) == -1) Another bug is, when a read(2) error occurred, read(2) may actually read something and change the file position then returning -1; when this happens the later lseek(2) call will over seeking the current position, skipping data that unrelated to the first read(2) error. The attached patch fix both bug.