mirror of
https://git.freebsd.org/src.git
synced 2026-01-11 19:57:22 +00:00
fdread: Fix logic bug when reading by sector
When reading by sector (because reading a whole track failed), we can accidentally fall into the "should not happen" path, which both (a) emits a spurious error message and (b) fouls up our position accounting going forward. Ensure we do not inappropriately fall into that path. Avoid obscuring the "short after" message in cases where it happens. Signed-off-by: Matt Jacobson <mhjacobson@me.com> Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1897
This commit is contained in:
parent
f7725c3c27
commit
4c8bf76893
1 changed files with 2 additions and 1 deletions
|
|
@ -275,12 +275,13 @@ doread(int fd, FILE *of, const char *_devname)
|
|||
errx(EX_OSERR, "unexpected read() result: %d",
|
||||
rv);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if ((unsigned)rv < tracksize) {
|
||||
/* should not happen */
|
||||
nbytes += rv;
|
||||
if (!quiet)
|
||||
fprintf(stderr, "\nshort after %5d KB\r",
|
||||
fprintf(stderr, "\nshort after %5d KB\n",
|
||||
nbytes / 1024);
|
||||
fwrite(trackbuf, sizeof(unsigned char), rv, of);
|
||||
fflush(of);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue