From cb9e3a9ac9034d85f5cc4a04ec550c795fd1ffc5 Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Sat, 12 Mar 2016 15:40:05 -0500 Subject: [PATCH] Set pw_gecos to "" on 64-bit The pw_getcos field on struct passwd is defined on 64-bit builds but is NULL which programs does not handle (at least no openssh which crashes). Initialize this field to "" to avoid this. --- ndk_patches/pwd.patch | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ndk_patches/pwd.patch b/ndk_patches/pwd.patch index c35e60cc4..1447c38ea 100644 --- a/ndk_patches/pwd.patch +++ b/ndk_patches/pwd.patch @@ -12,7 +12,7 @@ diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/incl #define _PATH_PASSWD "/etc/passwd" #define _PATH_MASTERPASSWD "/etc/master.passwd" #define _PATH_MASTERPASSWD_LOCK "/etc/ptmp" -@@ -119,7 +123,37 @@ +@@ -119,7 +123,40 @@ int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**); int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**); @@ -29,6 +29,9 @@ diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/incl + } + pw->pw_dir = "@TERMUX_HOME@"; + pw->pw_passwd = "*"; ++#ifdef __LP64__ ++ pw->pw_gecos = ""; /* Avoid NULL field. */ ++#endif +} + +static struct passwd* android_polyfill_getpwuid(uid_t t) {