From b80efa2003d8208dc5ebdee285c363dc9c5e5844 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Tue, 12 Sep 2023 20:03:04 +0000 Subject: Try another workaround for bad struct stat Signed-off-by: Laurent Bercot --- src/include/skalibs/stat.h | 29 +++++++++++------------------ src/sysdeps/trystatimespec.c | 3 +++ 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/src/include/skalibs/stat.h b/src/include/skalibs/stat.h index de85cce..ac13e54 100644 --- a/src/include/skalibs/stat.h +++ b/src/include/skalibs/stat.h @@ -3,29 +3,22 @@ #ifndef SKALIBS_STAT_H #define SKALIBS_STAT_H -#include - -#ifdef SKALIBS_HASSTATIM - -#define ST_ATIM st_atim -#define ST_MTIM st_mtim -#define ST_CTIM st_ctim + /* + This header must always be paired with skalibs/nonposix.h + (which must always come first). + If you #include before this, it will not work. + */ -#else - -#ifdef SKALIBS_HASSTATIMESPEC +#include -#define ST_ATIM st_atimespec -#define ST_MTIM st_mtimespec -#define ST_CTIM st_ctimespec +#include -#else +#if !defined(SKALIBS_HASSTATIM) && defined(SKALIBS_HASSTATIMESPEC) -#define ST_ATIM st_how_the_fuck_do_you_even_get_atime_on_this_OS -#define ST_MTIM st_how_the_fuck_do_you_even_get_mtime_on_this_OS -#define ST_CTIM st_how_the_fuck_do_you_even_get_ctime_on_this_OS +#define st_atim st_atimespec +#define st_mtim st_mtimespec +#define st_ctim st_ctimespec -#endif #endif #endif diff --git a/src/sysdeps/trystatimespec.c b/src/sysdeps/trystatimespec.c index 2690d57..3c12237 100644 --- a/src/sysdeps/trystatimespec.c +++ b/src/sysdeps/trystatimespec.c @@ -1,5 +1,8 @@ /* ISC license. */ +#undef _POSIX_C_SOURCE +#undef _XOPEN_SOURCE + #include #include -- cgit v1.2.3