From fc21a772429ff6655ba1d1c4b812ec755c2e5381 Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Tue, 26 Apr 2005 17:28:28 +0000 Subject: add test to see if we get back a bad result from read --- isomd5sum/libcheckisomd5.c | 5 +++++ loader2/mediacheck.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/isomd5sum/libcheckisomd5.c b/isomd5sum/libcheckisomd5.c index fc952bcaf..552055634 100644 --- a/isomd5sum/libcheckisomd5.c +++ b/isomd5sum/libcheckisomd5.c @@ -206,6 +206,11 @@ static int checkmd5sum(int isofd, char *mediasum, char *computedsum, int quiet) if (nread <= 0) break; + if (nread > nattempt) { + fprintf(stderr, "Warning: read got more data than requested\n"); + nread = nattempt; + lseek(isofd, offset+nread, SEEK_SET); + } /* overwrite md5sum we implanted with original data */ if (offset < apoff && offset+nread >= apoff) { appdata_start_offset = apoff - offset; diff --git a/loader2/mediacheck.c b/loader2/mediacheck.c index ead02a706..256f1c3ac 100644 --- a/loader2/mediacheck.c +++ b/loader2/mediacheck.c @@ -223,6 +223,11 @@ static int checkmd5sum(int isofd, char *mediasum, char *computedsum, if (nread <= 0) break; + if (nread > nattempt) { + fprintf(stderr, "Warning: read got more data than requested\n"); + nread = nattempt; + lseek(isofd, offset+nread, SEEK_SET); + } /* overwrite md5sum we implanted with original data */ if (offset < apoff && offset+nread >= apoff) { appdata_start_offset = apoff - offset; -- cgit