[PATCH] linedit, deluser: use POSIX getpwent instead of getpwent_r

Denys Vlasenko vda.linux at googlemail.com
Sat Feb 7 15:28:54 UTC 2015


On Sat, Feb 7, 2015 at 3:48 PM, tito <farmatito at tiscali.it> wrote:
>>         char *line=0;
>>         size_t size=0;
>>         if (!f) f = fopen("/etc/passwd", "rbe");
>>         if (!f) return 0;
> Hi,
> this should return ENOENT

You are correct.

>
>>         *pwbufp = __getpwent_a(f, pwbuf, &line, &size);
>>         if (!*pwbufp)
>>                 return 0; /* success (eof) */
>
> this should return ENOENT on EOF and 0 otherwise
> or you will be stuck in infite loops.

This is definitely EOF, not a "success, we got next entry" (since pw == NULL),
so should be "return ENOENT".


More information about the busybox mailing list