util.c
changeset 5 7718f04c8cd1
parent 4 5701b7859a31
child 10 d07309450285
--- a/util.c	Wed Sep 14 16:49:28 2011 -0700
+++ b/util.c	Thu Sep 22 21:43:25 2011 -0700
@@ -149,9 +149,13 @@
 		return( NULL );
 	}
 
-	fread( contents, sizeof(char), sb.st_size, fh );
+	if ( fread( contents, sizeof(char), sb.st_size, fh ) != sb.st_size ) {
+		debug( 1, LOC, "Short read for file '%s'?: %s\n", file );
+		fclose( fh );
+		return( NULL );
+	}
+
 	fclose( fh );
-
 	return( contents );
 }