sizeof(buf) - 1 to sizeof(buf), since fgets takes the whole buffer size. Based on diff from Charles Longeau <chl at tuxfamily dot org> long ago. OK millert@.