small patch to fix android ndk build of busybox

Denys Vlasenko vda.linux at googlemail.com
Fri Jan 6 15:27:21 UTC 2012


On Thu, Jan 5, 2012 at 7:52 PM, Dan Fandrich <dan at coneharvesters.com> wrote:
> On Thu, Jan 05, 2012 at 03:06:06PM +0000, Hin-Tak Leung wrote:
>> The error message was in the change-log, included in the patch:
>>
>> ---------
>>     libbb/lib.a(change_identity.o): In function `change_identity':
>>     change_identity.c:(.text.change_identity+0x28): undefined reference to `endgrent'
>>     collect2: ld returned 1 exit status
>>     make: *** [busybox_unstripped] Error 1
>> ---------
>>
>> Maybe the problem is in libbb/change_identity.c ?
>
> I've been getting the same problem lately. I worked around it locally with
> this patch:
>
> --- a/libbb/change_identity.c
> +++ b/libbb/change_identity.c
> @@ -35,7 +35,9 @@ void FAST_FUNC change_identity(const struct passwd *pw)
>  {
>        if (initgroups(pw->pw_name, pw->pw_gid) == -1)
>                bb_perror_msg_and_die("can't set groups");
> +#ifndef __ANDROID__
>        endgrent(); /* helps to close a fd used internally by libc */
> +#endif
>        xsetgid(pw->pw_gid);
>        xsetuid(pw->pw_uid);
>  }
>
> but it seemed a bit inelegant to me. But, that that line seems to have been
> added to work around a specific libc issue, maybe it's not to ugly to
> remove it on libcs that don't have that issue.

How about this fix?

http://git.busybox.net/busybox/commit/?id=6b64a269766ace40c56826738de446537add37de

-- 
vda


More information about the busybox mailing list