diff options
author | Peter Jones <pjones@redhat.com> | 2005-04-26 17:28:28 +0000 |
---|---|---|
committer | Peter Jones <pjones@redhat.com> | 2005-04-26 17:28:28 +0000 |
commit | fc21a772429ff6655ba1d1c4b812ec755c2e5381 (patch) | |
tree | 97969f542dbb0113194e2fea80fda29409ee66e5 | |
parent | 005a95745351a0f3b2051f4486f692d1e4190fa8 (diff) | |
download | anaconda-fc21a772429ff6655ba1d1c4b812ec755c2e5381.tar.gz anaconda-fc21a772429ff6655ba1d1c4b812ec755c2e5381.tar.xz anaconda-fc21a772429ff6655ba1d1c4b812ec755c2e5381.zip |
add test to see if we get back a bad result from read
-rw-r--r-- | isomd5sum/libcheckisomd5.c | 5 | ||||
-rw-r--r-- | loader2/mediacheck.c | 5 |
2 files changed, 10 insertions, 0 deletions
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; |