afs: Indicate error from afs_osi_Read/Write better
[openafs.git] / src / afs / FBSD / osi_file.c
index 02fe253..7c695d6 100644 (file)
@@ -170,7 +170,7 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
        if (!afs_shuttingdown)
            osi_Panic("osi_Read called with null param");
        else
-           return EIO;
+           return -EIO;
     }
 
     if (offset != -1)
@@ -187,7 +187,9 @@ afs_osi_Read(struct osi_file *afile, int offset, void *aptr,
     } else {
        afs_Trace2(afs_iclSetp, CM_TRACE_READFAILED, ICL_TYPE_INT32, resid,
                   ICL_TYPE_INT32, code);
-       code = -1;
+       if (code > 0) {
+           code *= -1;
+       }
     }
     return code;
 }
@@ -216,7 +218,9 @@ afs_osi_Write(struct osi_file *afile, afs_int32 offset, void *aptr,
        code = asize - resid;
        afile->offset += code;
     } else {
-       code = -1;
+       if (code > 0) {
+           code *= -1;
+       }
     }
     if (afile->proc) {
        (*afile->proc) (afile, code);