Dan Fandrich | 5 Jan 2012 19:52
Favicon

Re: small patch to fix android ndk build of busybox

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
 <at>  <at>  -35,7 +35,9  <at>  <at>  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.

>>> Dan

Gmane