Forget the example of a filled slurpd write file system. It is a bad example. More in general though, the fgets() call reserves the right to return error situations as NULL, and this should be handled instead of assuming that a NULL return indicates an EOF situation.