git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Don't define _XOPEN_SOURCE to unbreak compilation on FreeBSD

From
RRRocco Rutte <pdmef@gmx.net>
Date
Dec 21, 2006, 10:47 UTC
Message-ID
<11666980484010-git-send-email-pdmef@gmx.net>

FreeBSD 6 requires the __BSD_VISIBLE flag for fchmod(), IPPROTO_IPV6 and more which is only properly set by <sys/cdefs.h> if _POSIX_C_SOURCE isn't present. However, _POSIX_C_SOURCE is defined if _XOPEN_SOURCE is defined and >=500.

As a solution, simply don't define _XOPEN_SOURCE for FreeBSD and continue with its defaults.

Signed-off-by: Rocco Rutte <pdmef@gmx.net>
---
 git-compat-util.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/git-compat-util.h b/git-compat-util.h
index bc296b3..27d3b89 100644
--- a/git-compat-util.h
+++ b/git-compat-util.h
@@ -11,7 +11,12 @@
 
 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
 
-#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
+#if !defined(__FreeBSD__)
+#define _XOPEN_SOURCE 600        /* glibc2 and AIX 5.3L need 500,
+                                  * OpenBSD needs 600 for S_ISLNK(),
+                                  * FreeBSD 6 doesn't like it
+                                  */
+#endif
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #define _GNU_SOURCE
 #define _BSD_SOURCE
-- 
1.4.4.2.g9474f
Message 1 of 1 in “Don't define _XOPEN_SOURCE to unbreak compilation on FreeBSD”
  1. Don't define _XOPEN_SOURCE to unbreak compilation on FreeBSDRocco Rutte, Dec 21, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.