Index: /branches/eam_branch_20071130/Ohana/src/libfits/header/F_read_H.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/header/F_read_H.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/header/F_read_H.c	(revision 15733)
@@ -34,4 +34,8 @@
     Nbytes = fread (&header[0].buffer[i*FT_RECORD_SIZE], 
 		    sizeof(char), FT_RECORD_SIZE, f);
+    if (Nbytes != FT_RECORD_SIZE) {
+      perror ("fits read error");
+    }
+    
     header[0].size += Nbytes;
     if (Nbytes != FT_RECORD_SIZE) {
Index: /branches/eam_branch_20071130/Ohana/src/libfits/include/gfitsio.h
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/include/gfitsio.h	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/include/gfitsio.h	(revision 15733)
@@ -2,4 +2,5 @@
 
 # include <assert.h>
+# include <errno.h>
 
 # ifndef GFITSIO
Index: /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_load_M.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_load_M.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_load_M.c	(revision 15733)
@@ -30,4 +30,7 @@
 
   nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
+  if (nbytes != Nbytes) {
+    perror ("fits matrix read error");
+  }
 
 # ifdef BYTE_SWAP  
Index: /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_portion.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_portion.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_portion.c	(revision 15733)
@@ -47,4 +47,8 @@
   fseek (f, header.size + Nskip, SEEK_SET);
   nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
+  if (nbytes != Nbytes) {
+    perror ("fits matrix read error");
+  }
+
   fclose (f);
 
Index: /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_segment.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_segment.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/matrix/F_read_segment.c	(revision 15733)
@@ -90,4 +90,8 @@
   fseek (f, Nskip, SEEK_CUR);
   nbytes = fread (matrix[0].buffer, sizeof(char), Nbytes, f);
+  if (nbytes != Nbytes) {
+    perror ("fits matrix read error");
+  }
+
   matrix[0].size = Nbytes;
 
Index: /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_T.c	(revision 15733)
@@ -59,4 +59,5 @@
   Nread = fread (table[0].buffer, sizeof (char), Nbytes, f);
   if (Nread != Nbytes) {
+    perror ("fits read error");
     gfits_free_table  (table);
     return (FALSE);
@@ -84,6 +85,9 @@
 
   fseek (f, Nskip, SEEK_CUR);
+  fprintf (stderr, "file is at %ld\n", ftell(f));
+
   Nread = fread (buffer, sizeof (char), Nbytes, f);
   if (Nread != Nbytes) {
+    perror ("fits read error");
     free (buffer);
     return (FALSE);
@@ -120,4 +124,5 @@
   Nread = fread (buffer, sizeof (char), Nbytes, f);
   if (Nread != Nbytes) {
+    perror ("fits read error");
     free (buffer);
     return (FALSE);
@@ -178,5 +183,8 @@
       fseek (f, offset, SEEK_SET);
       Nread = fread (table[0].buffer[i], sizeof (char), Nx, f);
-      if (Nread != Nx) { return (FALSE); }
+      if (Nread != Nx) { 
+	perror ("fits read error");
+	return (FALSE); 
+      }
     }
 
Index: /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_TH.c
===================================================================
--- /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_TH.c	(revision 15732)
+++ /branches/eam_branch_20071130/Ohana/src/libfits/table/F_read_TH.c	(revision 15733)
@@ -46,4 +46,8 @@
     Nbytes = fread (&Theader[0].buffer[i*FT_RECORD_SIZE], 
 		    sizeof(char), FT_RECORD_SIZE, f);
+    if (Nbytes != FT_RECORD_SIZE) {
+      perror ("fits matrix read error");
+    }
+
     Theader[0].size += Nbytes;
     if (Nbytes != FT_RECORD_SIZE) 
