The fread calls were ignoring the return values. This commit properly treats them as potential error conditions.