]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
stat: work around IBM xlC bug
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 5 Mar 2018 23:50:39 +0000 (15:50 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 5 Mar 2018 23:51:06 +0000 (15:51 -0800)
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.

src/stat.c

index 8614a4d11f6f5448b3b6ac89e6599547dced12e4..c5da60260a5d9fa9054fa92f3e86ff454b0b2a6d 100644 (file)
@@ -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 +"];