OSDN Git Service

define pw_gecos to pw_passwd for LP32 systems
authorMike Frysinger <vapier@google.com>
Wed, 3 Feb 2016 19:40:37 +0000 (14:40 -0500)
committerMike Frysinger <vapier@google.com>
Sat, 6 Feb 2016 14:28:44 +0000 (09:28 -0500)
Since we set both fields to NULL all the time, we can alias the two
fields together on LP32 to provide build-time compatibility.

BUG=24918750
TEST=python now builds for Brillo boards

Change-Id: I3394aea80c9a5288669389f71d0e4132f2157e3c

libc/bionic/stubs.cpp
libc/include/pwd.h

index 0340f0e..374d015 100644 (file)
@@ -116,6 +116,7 @@ static int do_getpw_r(int by_name, const char* name, uid_t uid,
   snprintf(buf, byte_count, "%s%c%s%c%s", src->pw_name, 0, src->pw_dir, 0, src->pw_shell);
 
   // pw_passwd and pw_gecos are non-POSIX and unused (always NULL) in bionic.
+  // Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL.
   dst->pw_passwd = NULL;
 #if defined(__LP64__)
   dst->pw_gecos = NULL;
index 6012b96..905bc75 100644 (file)
@@ -106,6 +106,9 @@ struct passwd
   gid_t pw_gid;
 #ifdef __LP64__
   char* pw_gecos;
+#else
+  // Note: On LP32, we define pw_gecos to pw_passwd since they're both NULL.
+# define pw_gecos pw_passwd
 #endif
   char* pw_dir;
   char* pw_shell;