From 281f1fa30ac3558d0e5e1573bdb9113291815bcd Mon Sep 17 00:00:00 2001 From: Richard Yao Date: Sun, 9 Apr 2017 15:00:03 -0400 Subject: [PATCH] Fix `zpool iostat -T d 1` on musl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When building on Gentoo against musl, GCC complains: timestamp.c: In function ‘print_timestamp’: timestamp.c:32:19: warning: passing argument 1 of ‘nl_langinfo’ makes integer from pointer without a cast #define _DATE_FMT "%+" ^ timestamp.c:47:21: note: in expansion of macro ‘_DATE_FMT’ fmt = nl_langinfo(_DATE_FMT); ^ The error was wrapped to meet comment style requirements. This code is used by `zpool iostat -T d 1` to print a date and upon testing it, I see no date printed. Lets use D_T_FMT so that something gets printed and if D_T_FMT is not avaliable, then we can fall back to "%+". Reviewed-by: George Melikov Reviewed-by: loli10K Reviewed-by: Brian Behlendorf Reviewed-by: George Melikov Signed-off-by: Richard Yao Closes #5993 --- lib/libspl/timestamp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/libspl/timestamp.c b/lib/libspl/timestamp.c index e2838da121..eab15f3f13 100644 --- a/lib/libspl/timestamp.c +++ b/lib/libspl/timestamp.c @@ -29,8 +29,12 @@ #include "statcommon.h" #ifndef _DATE_FMT +#ifdef D_T_FMT +#define _DATE_FMT D_T_FMT +#else /* D_T_FMT */ #define _DATE_FMT "%+" -#endif +#endif /* !D_T_FMT */ +#endif /* _DATE_FMT */ /* * Print timestamp as decimal reprentation of time_t value (-T u was specified)