On Mon, Mar 12, 2012 at 1:18 PM, Mark Kettenis <mark.kette...@xs4all.nl> wrote: >> Date: Mon, 12 Mar 2012 13:45:58 +0100 >> From: Jan Klemkow <j.klem...@wemelug.de> >> >> The return of EINVAL on fp NULL comes from me. I think its even an >> invalid argument like the other pointers. > > We tend to take the position that it is better to crash hard that > return an error if an invalid argument gets passed to a library > function. Returning an error just hides bugs because people forget to > check return values. POSIX demands that we return EINVAL if lineptr > or n is NULL, so we have to do that even though we consider it to be > unhelpful. But since it doesn't say anything about fp I think you > should drop the fp == NULL check.
That's not correct. POSIX says: For the conditions under which the getdelim() and getline() functions shall fail and may fail, refer to fgetc so if fp is NULL we should return EBADF. f.-