client/ASYNC_VERIFY::verify_chunk: check ferror() after a fread()/fwrite()

This commit is contained in:
Tay Ray Chuan 2013-02-12 22:40:23 +08:00 committed by Vitalii Koshura
parent fccd486413
commit d111209f35
No known key found for this signature in database
GPG Key ID: CE0DB1726070A5A3
1 changed files with 2 additions and 2 deletions

View File

@ -288,7 +288,7 @@ int ASYNC_VERIFY::verify_chunk() {
return 1;
} else {
size_t m = fwrite(buf, 1, n, out);
if (m != n) {
if (m != n || ferror(out)) {
// write failed
//
error(ERR_FWRITE);
@ -298,7 +298,7 @@ int ASYNC_VERIFY::verify_chunk() {
}
} else {
n = fread(buf, 1, BUFSIZE, in);
if (!n) {
if (!n || ferror(in)) {
fclose(in);
finish();
return 1;