LDAP: support building on GNU/kFreeBSD and GNU/Hurd
authorMike Hommey <glandium@debian.org>
Tue, 11 Mar 2008 07:29:25 +0000 (08:29 +0100)
committerCarsten Schoenert <c.schoenert@t-online.de>
Thu, 16 Mar 2023 15:55:25 +0000 (15:55 +0000)
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

index ee6a1115528a6c651114c7082f06bed6fb00f86b..87a90f5b652e81e1ae312c3e61f1b7d722ab56e1 100644 (file)
 #endif
 
 #if defined(LINUX) || defined(__GNU__) || defined(__GLIBC__)
+#ifdef NEXTSTEP
+#include <bsd/libc.h>
+
+/*
+** 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 <getopt.h>
 #endif