Index: trunk/pswarp/src/pswarpLoop.c
===================================================================
--- trunk/pswarp/src/pswarpLoop.c	(revision 27096)
+++ trunk/pswarp/src/pswarpLoop.c	(revision 27101)
@@ -39,12 +39,20 @@
 {
     pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
-    bool status = true;                 ///< Status of checks
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+        psFree(view);
+        return false;
+    }
     view->chip = 0;
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+        psFree(view);
+        return false;
+    }
     view->cell = 0;
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_BEFORE);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+        psFree(view);
+        return false;
+    }
     psFree(view);
-    return status;
+    return true;
 }
 
@@ -57,12 +65,20 @@
     pmFPAview *view = pmFPAviewAlloc(0); ///< View for checking
     view->chip = view->cell = 0;
-    bool status = true;                 ///< Status of checks
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+        psFree(view);
+        return false;
+    }
     view->cell = -1;
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+        psFree(view);
+        return false;
+    }
     view->chip = -1;
-    status &= pmFPAfileIOChecks(config, view, PM_FPA_AFTER);
+    if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+        psFree(view);
+        return false;
+    }
     psFree(view);
-    return status;
+    return true;
 }
 
@@ -151,5 +167,8 @@
         fileActivation(config, independentFiles, false);
         fileActivation(config, skycellFiles, true);
-        ioChecksBefore(config);
+        if (!ioChecksBefore(config)) {
+            psError(psErrorCodeLast(), false, "Unable to read files.");
+            return false;
+        }
         fileActivation(config, skycellFiles, false);
     }
@@ -162,5 +181,6 @@
         pmChip *chip;
         pmFPAview *view = pmFPAviewAlloc(0);
-        if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
+        if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+            psError(psErrorCodeLast(), false, "Unable to read files.");
             return false;
         }
@@ -169,4 +189,5 @@
             if (!chip->process || !chip->file_exists) { continue; }
             if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+                psError(psErrorCodeLast(), false, "Unable to read files.");
                 return false;
             }
@@ -177,12 +198,15 @@
                 if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE) ||
                     !pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
+                    psError(psErrorCodeLast(), false, "Unable to read files.");
                     return false;
                 }
             }
             if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
+                psError(psErrorCodeLast(), false, "Unable to write files.");
                 return false;
             }
         }
         if (!pmFPAfileIOChecks (config, view, PM_FPA_AFTER)) {
+            psError(psErrorCodeLast(), false, "Unable to write files.");
             return false;
         }
@@ -222,4 +246,5 @@
     // files associated with the science image
     if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
+        psError(psErrorCodeLast(), false, "Unable to read files.");
         return false;
     }
@@ -230,4 +255,5 @@
         if (!chip->process || !chip->file_exists) { continue; }
         if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
+            psError(psErrorCodeLast(), false, "Unable to read files.");
             return false;
         }
@@ -257,4 +283,5 @@
             if (!cell->process || !cell->file_exists) { continue; }
             if (!pmFPAfileIOChecks (config, view, PM_FPA_BEFORE)) {
+                psError(psErrorCodeLast(), false, "Unable to read files.");
                 return false;
             }
@@ -266,4 +293,5 @@
             while ((readout = pmFPAviewNextReadout(view, input->fpa, 1)) != NULL) {
                 if (!pmFPAfileIOChecks(config, view, PM_FPA_BEFORE)) {
+                    psError(psErrorCodeLast(), false, "Unable to read files.");
                     return false;
                 }
@@ -283,12 +311,15 @@
 
                 if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+                    psError(psErrorCodeLast(), false, "Unable to write files.");
                     return false;
                 }
             }
             if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+                psError(psErrorCodeLast(), false, "Unable to write files.");
                 return false;
             }
         }
         if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+            psError(psErrorCodeLast(), false, "Unable to write files.");
             return false;
         }
@@ -404,4 +435,5 @@
 
     if (!pmFPAfileIOChecks(config, view, PM_FPA_AFTER)) {
+        psError(psErrorCodeLast(), false, "Unable to write files.");
         return false;
     }
@@ -416,5 +448,8 @@
     if (psMetadataLookupBool(&mdok, recipe, "PSF")) {
         fileActivation(config, photFiles, true);
-        ioChecksBefore(config);
+        if (!ioChecksBefore(config)) {
+            psError(psErrorCodeLast(), false, "Unable to read files.");
+            return false;
+        }
 
         // supply the readout and fpa of interest to psphot
@@ -501,5 +536,8 @@
     fileActivation(config, independentFiles, true);
     fileActivation(config, skycellFiles, true);
-    ioChecksAfter(config);
+    if (!ioChecksAfter(config)) {
+        psError(psErrorCodeLast(), false, "Unable to write files.");
+        return false;
+    }
 
     // Write out summary statistics
