On Thu, Oct 10, 2013 at 12:27:46AM -0400, Dmitri Pal wrote: > Hello, > > I came across an interesting behavior that is IMO worth sharing with > other developers. > It turns out that fmemopen() fails with error 22 EINVAL if the buffer > passed in is of length 0. > > Imagine situation: I have a file in the directory of 0 length. > I open it with fopen() or with open() and then fdopen() in "r" mode and > I can read it with getline(). Of cause the first read will return EOF > and I will be done. But if I open file with open() in binary mode, and > mirror it into a buffer and the file is of length 0 then the buffer will > be of length 0 too but attemt to use fmemopen() would fail. > So mirroring in becomes non transparent operation you have to special > case the situation when original file in NULL. > > So question is what should I do with it? File a bug or just ask to > document it? Man page does not say anything about it. > Advises welcome.
It's a doc issue, http://pubs.opengroup.org/onlinepubs/9699919799/functions/fmemopen.html says: "... [EINVAL] The size argument specifies a buffer size of zero. ..." I think it would be nice if the ERRORS section canbe added to the man page. bye, Sumit > > -- > Thank you, > Dmitri Pal > > Sr. Engineering Manager for IdM portfolio > Red Hat Inc. > > > ------------------------------- > Looking to carve out IT costs? > www.redhat.com/carveoutcosts/ > > > > _______________________________________________ > sssd-devel mailing list > sssd-devel@lists.fedorahosted.org > https://lists.fedorahosted.org/mailman/listinfo/sssd-devel _______________________________________________ sssd-devel mailing list sssd-devel@lists.fedorahosted.org https://lists.fedorahosted.org/mailman/listinfo/sssd-devel