From 5cbd2187c63a501d995610826b66778662107953 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 11 Mar 2008 08:29:25 +0100 Subject: [PATCH] LDAP: support building on GNU/kFreeBSD and GNU/Hurd https://bugzilla.mozilla.org/show_bug.cgi?id=356011 Squashed kFreeBSD/Hurd related fixes: - Fix FTBFS on Hurd-i386 - Build fixes for GNU/kFreeBSD in directory/ - Missing bits for Hurd support Gbp-Pq: Topic porting-kfreebsd-hurd Gbp-Pq: Name LDAP-support-building-on-GNU-kFreeBSD-and-GNU-Hurd.patch --- nsprpub/config/nsinstall.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/nsprpub/config/nsinstall.c b/nsprpub/config/nsinstall.c index ee6a111552..87a90f5b65 100644 --- a/nsprpub/config/nsinstall.c +++ b/nsprpub/config/nsinstall.c @@ -40,6 +40,31 @@ #endif #if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) +#ifdef NEXTSTEP +#include + +/* +** balazs.pataki@sztaki.hu: The getcwd is broken in NEXTSTEP (returns 0), +** when called on a mounted fs. Did anyone notice this? Here's an ugly +** workaround ... +*/ +#define getcwd(b,s) my_getcwd(b,s) + +static char * +my_getcwd (char *buf, size_t size) +{ + FILE *pwd = popen("pwd", "r"); + char *result = fgets(buf, size, pwd); + + if (result) { + buf[strlen(buf)-1] = '\0'; + } + pclose (pwd); + return buf; +} +#endif /* NEXTSTEP */ + +#if defined(LINUX) || defined(__GLIBC__) || defined(__GNU__) #include #endif -- 2.30.2