stat: fix compilation on AIX
authorMichael Haubenwallner <michael.haubenwallner@salomon.at>
Fri, 30 Oct 2009 23:00:03 +0000 (17:00 -0600)
committerEric Blake <ebb9@byu.net>
Fri, 30 Oct 2009 23:00:03 +0000 (17:00 -0600)
AC_SYS_LARGEFILE turns on large-file support, but in that mode, AIX
provides only struct stat64, and not struct stat.

* lib/sys_stat.in.h (stat): Work with fact that large files on AIX
only see struct stat64.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/sys_stat.in.h

index c146bcb..6cb34dc 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-30  Michael Haubenwallner  <michael.haubenwallner@salomon.at>
+
+       stat: fix compilation on AIX
+       * lib/sys_stat.in.h (stat): Work with fact that large files on AIX
+       only see struct stat64.
+
 2009-10-30  Eric Blake  <ebb9@byu.net>
 
        exclude: make more robust
index e7cb5ee..1e46da8 100644 (file)
@@ -456,7 +456,15 @@ int mknodat (int fd, char const *file, mode_t mode, dev_t dev);
    struct stat.  This means that rpl_stat will not be used if the user
    does (stat)(a,b).  Oh well.  */
 #  undef stat
-#  define stat(name, st) rpl_stat (name, st)
+#  ifdef _LARGE_FILES
+    /* With _LARGE_FILES defined, AIX (only) defines stat to stat64,
+       so we have to replace stat64() instead of stat(). */
+#   define stat stat64
+#   undef stat64
+#   define stat64(name, st) rpl_stat (name, st)
+#  else /* !_LARGE_FILES */
+#   define stat(name, st) rpl_stat (name, st)
+#  endif /* !_LARGE_FILES */
 extern int stat (const char *name, struct stat *buf);
 # endif
 #elif defined GNULIB_POSIXCHECK