handle the return value of fgets as suggested by GCC