summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2019-08-01 21:33:57 -0400
committerRich Felker <dalias@aerifal.cx>2019-10-28 19:26:52 -0400
commit0961bb94162896d358937e4979e5830f39818920 (patch)
tree3607292454dd6cc8a2c936fdc0ca32223b620ab3 /src
parent50018f92f7a1d79bc41a1ad5c5baf99eb7cd40af (diff)
downloadmusl-0961bb94162896d358937e4979e5830f39818920.tar.gz
make fstatat fill in old time32 stat fields too
here _REDIR_TIME64 is used as an indication that there's an old ABI, and thereby the old time32 timespec fields of struct stat. keeping struct stat compatible and providing both versions of the timespec fields is done so that ftw/nftw does not need painful compat shims, and (more importantly) so that similar interfaces between pairs of libc consumers (applications/libraries) will be less likely to break when one has been rebuilt for time64 but the other has not.
Diffstat (limited to 'src')
-rw-r--r--src/stat/fstatat.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/stat/fstatat.c b/src/stat/fstatat.c
index bf0a554c..de165b5c 100644
--- a/src/stat/fstatat.c
+++ b/src/stat/fstatat.c
@@ -57,6 +57,14 @@ static int fstatat_statx(int fd, const char *restrict path, struct stat *restric
.st_mtim.tv_nsec = stx.stx_mtime.tv_nsec,
.st_ctim.tv_sec = stx.stx_ctime.tv_sec,
.st_ctim.tv_nsec = stx.stx_ctime.tv_nsec,
+#if _REDIR_TIME64
+ .__st_atim32.tv_sec = stx.stx_atime.tv_sec,
+ .__st_atim32.tv_nsec = stx.stx_atime.tv_nsec,
+ .__st_mtim32.tv_sec = stx.stx_mtime.tv_sec,
+ .__st_mtim32.tv_nsec = stx.stx_mtime.tv_nsec,
+ .__st_ctim32.tv_sec = stx.stx_ctime.tv_sec,
+ .__st_ctim32.tv_nsec = stx.stx_ctime.tv_nsec,
+#endif
};
return 0;
}
@@ -110,6 +118,14 @@ static int fstatat_kstat(int fd, const char *restrict path, struct stat *restric
.st_mtim.tv_nsec = kst.st_mtime_nsec,
.st_ctim.tv_sec = kst.st_ctime_sec,
.st_ctim.tv_nsec = kst.st_ctime_nsec,
+#if _REDIR_TIME64
+ .__st_atim32.tv_sec = kst.st_atime_sec,
+ .__st_atim32.tv_nsec = kst.st_atime_nsec,
+ .__st_mtim32.tv_sec = kst.st_mtime_sec,
+ .__st_mtim32.tv_nsec = kst.st_mtime_nsec,
+ .__st_ctim32.tv_sec = kst.st_ctime_sec,
+ .__st_ctim32.tv_nsec = kst.st_ctime_nsec,
+#endif
};
return 0;