Code

Correct compiler warnings in fast-import.
[git.git] / git-compat-util.h
index f8d46d587bec2b4dbab0263fa3df97e60beb08e4..c1bcb001a51324ebcb66bfb0a695e20ff366df02 100644 (file)
@@ -15,8 +15,9 @@
 #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
 #endif
-#define _GNU_SOURCE
-#define _BSD_SOURCE
+#define _ALL_SOURCE 1
+#define _GNU_SOURCE 1
+#define _BSD_SOURCE 1
 
 #include <unistd.h>
 #include <stdio.h>
 #include <arpa/inet.h>
 #include <netdb.h>
 #include <pwd.h>
+#include <inttypes.h>
+#undef _ALL_SOURCE /* AIX 5.3L defines a struct list with _ALL_SOURCE. */
 #include <grp.h>
+#define _ALL_SOURCE 1
 
 #ifndef NO_ICONV
 #include <iconv.h>
@@ -202,6 +206,8 @@ static inline void *xmmap(void *start, size_t length,
 {
        void *ret = mmap(start, length, prot, flags, fd, offset);
        if (ret == MAP_FAILED) {
+               if (!length)
+                       return NULL;
                release_pack_memory(length);
                ret = mmap(start, length, prot, flags, fd, offset);
                if (ret == MAP_FAILED)