afs: Do not ignore errors in afs_CacheFetchProc
[openafs.git] / src / afs / afs_fetchstore.c
index eb32bbe..ed25a4d 100644 (file)
@@ -1150,11 +1150,15 @@ afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn,
 
     adc->validPos = base;
 
-    if ( !code ) do {
+    if (code) {
+        goto done;
+    }
+
+    do {
        if (avc->f.states & CForeign) {
            code = (*ops->more)(rock, &length, &moredata);
            if ( code )
-               break;
+               goto done;
        }
 #ifndef AFS_NOSTATS
        bytesToXfer += length;
@@ -1177,11 +1181,11 @@ afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn,
                           ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, code,
                           ICL_TYPE_INT32, length);
                code = -34;
-               break;
+               goto done;
            }
            code = (*ops->write)(rock, fP, offset, bytesread, &byteswritten);
            if ( code )
-               break;
+               goto done;
            offset += bytesread;
            base += bytesread;
            length -= bytesread;
@@ -1194,6 +1198,7 @@ afs_CacheFetchProc(struct afs_conn *tc, struct rx_connection *rxconn,
        }
        code = 0;
     } while (moredata);
+ done:
     if (!code)
        code = (*ops->close)(rock, avc, adc, tsmall);
     if (ops)