Index: trunk/psModules/src/objects/pmSourceIO_SX.c
===================================================================
--- trunk/psModules/src/objects/pmSourceIO_SX.c	(revision 15562)
+++ trunk/psModules/src/objects/pmSourceIO_SX.c	(revision 18845)
@@ -3,6 +3,6 @@
  *  @author EAM, IfA
  *
- *  @version $Revision: 1.14 $ $Name: not supported by cvs2svn $
- *  @date $Date: 2007-11-10 01:09:20 $
+ *  @version $Revision: 1.15 $ $Name: not supported by cvs2svn $
+ *  @date $Date: 2008-08-01 18:33:14 $
  *
  *  Copyright 2004 Maui High Performance Computing Center, University of Hawaii
@@ -60,5 +60,5 @@
         pmSource *source = (pmSource *) sources->data[i];
 
-	// no difference between PSF and non-PSF model
+        // no difference between PSF and non-PSF model
         pmModel *model = pmSourceGetModel (NULL, source);
         if (model == NULL)
@@ -70,5 +70,5 @@
         // pmSourceSextractType (source, &type, &flags);
 
-	axes = pmPSF_ModelToAxes (PAR, 20.0);
+        axes = pmPSF_ModelToAxes (PAR, 20.0);
 
         psLineInit (line);
@@ -85,5 +85,10 @@
         psLineAdd (line, "%9.4f",  source->apMag);
         psLineAdd (line, "%4d\n",  0); // should be flags
-        fwrite (line->line, 1, line->Nline, f);
+        if (fwrite(line->line, 1, line->Nline, f) < line->Nline) {
+            psError(PS_ERR_IO, true, "Unable to write SX sources file (%s)", filename);
+            fclose(f);
+            psFree(line);
+            return false;
+        }
     }
     fclose (f);
