util.c
changeset 5 7718f04c8cd1
parent 4 5701b7859a31
child 10 d07309450285
equal deleted inserted replaced
4:5701b7859a31 5:7718f04c8cd1
   147 		debug( 1, LOC, "Could not open file for reading '%s': %s\n",
   147 		debug( 1, LOC, "Could not open file for reading '%s': %s\n",
   148 				file, strerror(errno) );
   148 				file, strerror(errno) );
   149 		return( NULL );
   149 		return( NULL );
   150 	}
   150 	}
   151 
   151 
   152 	fread( contents, sizeof(char), sb.st_size, fh );
   152 	if ( fread( contents, sizeof(char), sb.st_size, fh ) != sb.st_size ) {
       
   153 		debug( 1, LOC, "Short read for file '%s'?: %s\n", file );
       
   154 		fclose( fh );
       
   155 		return( NULL );
       
   156 	}
       
   157 
   153 	fclose( fh );
   158 	fclose( fh );
   154 
       
   155 	return( contents );
   159 	return( contents );
   156 }
   160 }
   157 
   161 
   158 
   162 
   159 
   163