> Date: Mon, 12 Mar 2012 13:45:58 +0100 > From: Jan Klemkow <[email protected]> > > 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.
