Check return value of fgets.