Whamcloud - gitweb
ext2fs: work around FreeBSD header breakage
authorTheodore Ts'o <tytso@mit.edu>
Sat, 2 Jan 2016 01:12:22 +0000 (20:12 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Sat, 2 Jan 2016 01:12:22 +0000 (20:12 -0500)
FreeBSD 10.2 will blow up compiling its own header files in sys/file.h
if _XOPEN_SOURCE is defined.

In file included from tdb.c:59:
/usr/include/sys/file.h:209:2: error: unknown type name 'u_int'
        u_int   xf_flag;        /* flags (see fcntl.h) */
                ^
1 error generated.

This is despite the fact that POSIX.1 requires comforming applications
to define _XOPEN_SOURCE (to different numbers depending on the version
of POSIX.1 the program is expecting to work against).  See section
2.2.1 in POSIX.1 for chapter and verse.

Work around this by removing the _XOPEN_SOURCE declaration.  This will
cause compiler warnings (and will cause builds against some versions
of Solaris to break), so only do this for FreeBSD.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/tdb.c

index 61e30ed..b313f3a 100644 (file)
@@ -36,7 +36,9 @@ Last Changed Date: 2007-06-22 13:36:10 -0400 (Fri, 22 Jun 2007)
 #define HAVE_UTIME_H
 #define HAVE_UTIME
 #endif
+#ifndef __FreeBSD__
 #define _XOPEN_SOURCE 600
+#endif
 
 #include "config.h"
 #include <unistd.h>