[PATCH] Replace pw_gecos by empty string if not supported
Nathan
nathan.huesken at posteo.de
Tue Jan 29 23:32:38 CET 2013
---
System/Posix/User.hsc | 4 ++++
configure.ac | 2 ++
2 files changed, 6 insertions(+)
diff --git a/System/Posix/User.hsc b/System/Posix/User.hsc
index a62648d..de08314 100644
--- a/System/Posix/User.hsc
+++ b/System/Posix/User.hsc
@@ -453,7 +453,11 @@ unpackUserEntry ptr = do
passwd <- (#peek struct passwd, pw_passwd) ptr >>= peekCAString
uid <- (#peek struct passwd, pw_uid) ptr
gid <- (#peek struct passwd, pw_gid) ptr
+#ifdef HAVE_NO_PASSWD_PW_GECOS
+ gecos <- return "" -- pw_gecos does not exist on android
+#else
gecos <- (#peek struct passwd, pw_gecos) ptr >>= peekCAString
+#endif
dir <- (#peek struct passwd, pw_dir) ptr >>= peekCAString
shell <- (#peek struct passwd, pw_shell) ptr >>= peekCAString
return (UserEntry name passwd uid gid gecos dir shell)
diff --git a/configure.ac b/configure.ac
index 50763a4..e1eb68c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -52,6 +52,8 @@ AC_CHECK_MEMBERS([struct stat.st_uatime])
AC_CHECK_MEMBERS([struct stat.st_umtime])
AC_CHECK_MEMBERS([struct stat.st_uctime])
+AC_CHECK_MEMBER([struct passwd.pw_gecos], [], [AC_DEFINE([HAVE_NO_PASSWD_PW_GECOS],[],[Ignore the pw_gecos member of passwd where it does not exist])], [[#include <pwd.h>]])
+
# Functions for changing file timestamps
AC_CHECK_FUNCS([utimensat futimens])
AC_CHECK_FUNCS([lutimes futimes])
--
1.7.10.4
--------------000201040506040705090207
Content-Type: text/x-patch;
name="03_unix_telldir_seekdir.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
filename="03_unix_telldir_seekdir.patch"
More information about the ghc-devs
mailing list