|
Message-ID: <CAK7dMtAYxQSe-LeZcZzSo54x0SaU_Pis=CAnR+kHuz-abXQvdg@mail.gmail.com>
Date: Thu, 7 May 2015 05:53:43 -0700
From: Kevin Bowling <kevin.bowling@...009.com>
To: musl@...ts.openwall.com
Subject: fgetgrent_a questions/review
Hi,
I borrowed the fget*ent_a functions to port libnss-cache to FreeBSD because
the fgetent family of functions are not standard and the musl
implementations looked clean and compact with a good license.
https://github.com/google/libnss-cache/pull/1/files#diff-800bf143f84497855c6338a07c19b4af
I had to make a few changes which may be suitable for musl. First, getline
seems to resize the buffer as it pleases but this causes problems since the
glibc implementation uses fgets and generally something higher up the call
stack handles the resizing. Second, the current musl implementation
doesn't return ERANGE which was necessary to get the caller's (nsswitch)
code to do the right thing to the buffer.
Finally, I wasn't quite sure what to do with mem and nmem in this case. I
made mem static, and pass nmem in in a wrapper function.. but I do not know
if these are allocated and freed correctly used standalone like this?
Regards,
Kevin
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.