* lib/chown.c (rpl_chown): * lib/fchownat.c (rpl_fchownat): * lib/lchown.c (rpl_lchown): Avoid using designated initializers (or even ordinary initializers) in a way that provokes a bug in IBM XL C for AIX 16.1 (2018). IBM says they will support this old compiler through April 2026 with extended support through April 2029. --- ChangeLog | 9 +++++++++ lib/chown.c | 10 ++++++---- lib/fchownat.c | 10 ++++++---- lib/lchown.c | 10 ++++++---- 4 files changed, 27 insertions(+), 12 deletions(-)
diff --git a/ChangeLog b/ChangeLog index d52868356a..85d0713c16 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2026-02-14 Paul Eggert <[email protected]> + fchownat: port to IBM XL C for AIX 16.1 + * lib/chown.c (rpl_chown): + * lib/fchownat.c (rpl_fchownat): + * lib/lchown.c (rpl_lchown): + Avoid using designated initializers (or even ordinary initializers) + in a way that provokes a bug in IBM XL C for AIX 16.1 (2018). + IBM says they will support this old compiler through April 2026 + with extended support through April 2029. + stdcountof-h: port to IBM XL C for AIX 16.1 Improve the test for the bug in MSVC and Oracle Developer Studio so that it does not rely on symbols like _MSC_VER and so is more diff --git a/lib/chown.c b/lib/chown.c index 892b97a68b..dd9d00e162 100644 --- a/lib/chown.c +++ b/lib/chown.c @@ -133,10 +133,12 @@ rpl_chown (const char *file, uid_t owner, gid_t group) if (result == 0 && change_time_check && (((uid == st.st_uid) | uid_noop) & ((gid == st.st_gid) | gid_noop))) - utimensat (AT_FDCWD, file, - ((struct timespec[]) { get_stat_atime (&st), - get_stat_mtime (&st) }), - 0); + { + struct timespec times[2]; + times[0] = get_stat_atime (&st); + times[1] = get_stat_mtime (&st); + utimensat (AT_FDCWD, file, times, 0); + } return result; } diff --git a/lib/fchownat.c b/lib/fchownat.c index 55e5ebc472..5c9901fbbd 100644 --- a/lib/fchownat.c +++ b/lib/fchownat.c @@ -156,10 +156,12 @@ rpl_fchownat (int fd, char const *file, uid_t owner, gid_t group, int flag) if (result == 0 && change_time_check && (((owner == st.st_uid) | uid_noop) & ((group == st.st_gid) | gid_noop))) - utimensat (fd, file, - ((struct timespec[]) { get_stat_atime (&st), - get_stat_mtime (&st) }), - flag); + { + struct timespec times[2]; + times[0] = get_stat_atime (&st); + times[1] = get_stat_mtime (&st); + utimensat (fd, file, times, flag); + } return result; } diff --git a/lib/lchown.c b/lib/lchown.c index 09f707e3b3..a7e8b2595c 100644 --- a/lib/lchown.c +++ b/lib/lchown.c @@ -137,10 +137,12 @@ rpl_lchown (const char *file, uid_t owner, gid_t group) if (result == 0 && change_time_check && (((owner == st.st_uid) | uid_noop) & ((group == st.st_gid) | gid_noop))) - utimensat (AT_FDCWD, file, - ((struct timespec[]) { get_stat_atime (&st), - get_stat_mtime (&st) }), - AT_SYMLINK_NOFOLLOW); + { + struct timespec times[2]; + times[0] = get_stat_atime (&st); + times[1] = get_stat_mtime (&st); + utimensat (AT_FDCWD, file, times, AT_SYMLINK_NOFOLLOW); + } return result; } -- 2.51.0
