mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
Check for struct stat.st_ctime_nsec before using
Using a configure check for stat.st_ctime_nsec fixes building on Android which has that field but does not define STAT_HAVE_NSEC. Before this change the Android build failed on the st_ctim.tv_nsec fallback #else clause.
This commit is contained in:
parent
d8497f0f1e
commit
36f320598e
2 changed files with 2 additions and 1 deletions
|
@ -284,6 +284,7 @@ AC_DEFINE_UNQUOTED([WCHAR_T_BITS], [$WCHAR_T_BITS], [The size of wchar_t in bits
|
||||||
#
|
#
|
||||||
# Detect nanoseconds fields in struct stat
|
# Detect nanoseconds fields in struct stat
|
||||||
#
|
#
|
||||||
|
AC_CHECK_MEMBERS([struct stat.st_ctime_nsec])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
|
AC_CHECK_MEMBERS([struct stat.st_mtimespec.tv_nsec])
|
||||||
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
|
AC_CHECK_MEMBERS([struct stat.st_mtim.tv_nsec])
|
||||||
|
|
||||||
|
|
|
@ -548,7 +548,7 @@ file_id_t file_id_t::file_id_from_stat(const struct stat *buf) {
|
||||||
result.change_seconds = buf->st_ctime;
|
result.change_seconds = buf->st_ctime;
|
||||||
result.mod_seconds = buf->st_mtime;
|
result.mod_seconds = buf->st_mtime;
|
||||||
|
|
||||||
#if STAT_HAVE_NSEC
|
#ifdef HAVE_STRUCT_STAT_ST_CTIME_NSEC
|
||||||
result.change_nanoseconds = buf->st_ctime_nsec;
|
result.change_nanoseconds = buf->st_ctime_nsec;
|
||||||
result.mod_nanoseconds = buf->st_mtime_nsec;
|
result.mod_nanoseconds = buf->st_mtime_nsec;
|
||||||
#elif defined(__APPLE__)
|
#elif defined(__APPLE__)
|
||||||
|
|
Loading…
Reference in a new issue