Hi,

I cannot see why or since when this change is needed since the last time I 
built busybox ( a few months ago), as neither configs/android2_defconfig nor 
libpwdgrp nor libbb has changed much recently; but the change seems to be 
correct or at least should cause no harm, so here it is.

Cheers,
Hin-Tak
From 70a0e01dab1309684f52399a0677312ba52876a1 Mon Sep 17 00:00:00 2001
From: Hin-Tak Leung <[email protected]>
Date: Wed, 4 Jan 2012 02:25:37 +0000
Subject: [PATCH] libpwdgrp/pwd_grp: Fixes broken Android NDK build

Building with NDK standalone toolchain r7 failed with:

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

Android Bionic does not have passwd.pw_gecos ; so added #ifdef __BIONIC__
as referenced elsewhere (e.g. libbb/obscure.c).

Signed-off-by: Hin-Tak Leung <[email protected]>
---
 configs/android2_defconfig |    2 +-
 libpwdgrp/pwd_grp.c        |    2 ++
 2 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/configs/android2_defconfig b/configs/android2_defconfig
index b5166e0..6f866cf 100644
--- a/configs/android2_defconfig
+++ b/configs/android2_defconfig
@@ -438,7 +438,7 @@ CONFIG_FEATURE_MESG_ENABLE_ONLY_GROUP=y
 # CONFIG_ADD_SHELL is not set
 # CONFIG_REMOVE_SHELL is not set
 # CONFIG_FEATURE_SHADOWPASSWDS is not set
-# CONFIG_USE_BB_PWD_GRP is not set
+CONFIG_USE_BB_PWD_GRP=y
 # CONFIG_USE_BB_SHADOW is not set
 # CONFIG_USE_BB_CRYPT is not set
 # CONFIG_USE_BB_CRYPT_SHA is not set
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 2eb9d9d..e055672 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -783,7 +783,9 @@ static const unsigned char pw_off[] ALIGN1 = {
 	offsetof(struct passwd, pw_passwd),     /* 1 */
 	offsetof(struct passwd, pw_uid),        /* 2 - not a char ptr */
 	offsetof(struct passwd, pw_gid),        /* 3 - not a char ptr */
+#ifndef __BIONIC__
 	offsetof(struct passwd, pw_gecos),      /* 4 */
+#endif
 	offsetof(struct passwd, pw_dir),        /* 5 */
 	offsetof(struct passwd, pw_shell)       /* 6 */
 };
-- 
1.7.7.4

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to