From: Paul Eggert Date: Mon, 5 Mar 2018 23:50:39 +0000 (-0800) Subject: stat: work around IBM xlC bug X-Git-Tag: v8.30~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2eaf3a14a5235f62eba7f772b1afd076bea3aaa3;p=thirdparty%2Fcoreutils.git stat: work around IBM xlC bug Problem reported by John Wiersba (Bug#30718) * src/stat.c (human_time): Avoid giving an integer constant expression a name, as it runs afoul of a bug in IBM XL C/C++ for AIX 12.01.0000.0002. --- diff --git a/src/stat.c b/src/stat.c index 8614a4d11f..c5da60260a 100644 --- a/src/stat.c +++ b/src/stat.c @@ -590,12 +590,10 @@ human_access (struct stat const *statbuf) static char * ATTRIBUTE_WARN_UNUSED_RESULT human_time (struct timespec t) { - /* STR must be at least this big, either because localtime_rz fails, - or because the time zone is truly outlandish so that %z expands - to a long string. */ - enum { intmax_bufsize = INT_BUFSIZE_BOUND (intmax_t) }; - - static char str[intmax_bufsize + /* STR must be at least INT_BUFSIZE_BOUND (intmax_t) big, either + because localtime_rz fails, or because the time zone is truly + outlandish so that %z expands to a long string. */ + static char str[INT_BUFSIZE_BOUND (intmax_t) + INT_STRLEN_BOUND (int) /* YYYY */ + 1 /* because YYYY might equal INT_MAX + 1900 */ + sizeof "-MM-DD HH:MM:SS.NNNNNNNNN +"];