From 7cd723e685a83b0d5ae5e196bb90202c630fc571 Mon Sep 17 00:00:00 2001 From: George Amanakis Date: Tue, 19 May 2020 17:24:10 -0400 Subject: Fix gcc 10.1 stringop-truncation error As we do not expect the destination of these strncpy calls to be NULL terminated, substitute them with memcpy. Reviewed-by: Tony Hutter Reviewed-by: Brian Behlendorf Signed-off-by: George Amanakis Closes #10346 --- cmd/zpool/zpool_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'cmd/zpool') diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index e154e40e4..b149b3e20 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -8898,9 +8898,9 @@ zpool_do_events_short(nvlist_t *nvl, ev_opts_t *opts) verify(nvlist_lookup_int64_array(nvl, FM_EREPORT_TIME, &tv, &n) == 0); memset(str, ' ', 32); (void) ctime_r((const time_t *)&tv[0], ctime_str); - (void) strncpy(str, ctime_str+4, 6); /* 'Jun 30' */ - (void) strncpy(str+7, ctime_str+20, 4); /* '1993' */ - (void) strncpy(str+12, ctime_str+11, 8); /* '21:49:08' */ + (void) memcpy(str, ctime_str+4, 6); /* 'Jun 30' */ + (void) memcpy(str+7, ctime_str+20, 4); /* '1993' */ + (void) memcpy(str+12, ctime_str+11, 8); /* '21:49:08' */ (void) sprintf(str+20, ".%09lld", (longlong_t)tv[1]); /* '.123456789' */ if (opts->scripted) (void) printf(gettext("%s\t"), str); -- cgit v1.2.3