Index: trunk/Ohana/src/libdvo/src/dvo_catalog_split.c
===================================================================
--- trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 39311)
+++ trunk/Ohana/src/libdvo/src/dvo_catalog_split.c	(revision 39312)
@@ -109,4 +109,10 @@
   }
   off_t fullsize = catalog->header.datasize;
+
+  if (fflush (catalog->f)) {
+    perror ("fflush: ");
+    fprintf (stderr, "failed to flush file %s\n", catalog->filename);
+    return FALSE;
+  }
 
 # if (1)
@@ -168,4 +174,9 @@
       return (FALSE);
     }
+    if (fflush (catalog->f)) {
+      perror ("fflush: ");
+      fprintf (stderr, "failed to flush file %s\n", catalog->filename);
+      return FALSE;
+    }
     if (!gfits_fwrite_table (catalog->f, outtable)) {
       fprintf (stderr, "can't write table data\n");
@@ -211,4 +222,10 @@
   gfits_free_header (&cmpheader);
   gfits_free_table (&cmptable);
+
+  if (fflush (catalog->f)) {
+    perror ("fflush: ");
+    fprintf (stderr, "failed to flush file %s\n", catalog->filename);
+    return FALSE;
+  }
 
   // if the output file will be completely re-written, truncate to total datasize
@@ -275,5 +292,5 @@
   /* read PHU */
   if (!gfits_load_header (subcat[0].f, &subcat[0].header)) {
-    if (VERBOSE) fprintf (stderr, "error reading %s header: %s\n", name, subcat[0].filename);
+    if (VERBOSE) fprintf (stderr, "error reading PHU %s header: %s\n", name, subcat[0].filename);
     return (DVO_CAT_OPEN_FAIL);
   }
@@ -283,5 +300,5 @@
   /* read table header */
   if (!gfits_fread_header (subcat[0].f, header)) {
-    if (VERBOSE) fprintf (stderr, "can't read %s PHU header\n", name);
+    if (VERBOSE) fprintf (stderr, "can't read %s table header\n", name);
     gfits_free_header (&subcat[0].header);
     return (DVO_CAT_OPEN_FAIL);
