Fix -Wformat-truncation warning in upgrade_set_callback()

Extend the buffer slightly resolve the warning.

    cmd/zfs/zfs_main.c: In function ‘upgrade_set_callback’:
    cmd/zfs/zfs_main.c:2446:22: error: ‘%llu’ directive output
    may be truncated writing between 1 and 20 bytes into a
    region of size 16 [-Werror=format-truncation=]
    cmd/zfs/zfs_main.c:2445:24: note: ‘snprintf’ output between
    2 and 21 bytes into a destination of size 16

Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #13528
Closes #13575
This commit is contained in:
Brian Behlendorf 2022-06-20 21:54:42 +00:00
parent 60f2cfd24f
commit d483ef3744
1 changed files with 1 additions and 1 deletions

View File

@ -2480,7 +2480,7 @@ upgrade_set_callback(zfs_handle_t *zhp, void *data)
/* upgrade */ /* upgrade */
if (version < cb->cb_version) { if (version < cb->cb_version) {
char verstr[16]; char verstr[24];
(void) snprintf(verstr, sizeof (verstr), (void) snprintf(verstr, sizeof (verstr),
"%llu", (u_longlong_t)cb->cb_version); "%llu", (u_longlong_t)cb->cb_version);
if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) { if (cb->cb_lastfs[0] && !same_pool(zhp, cb->cb_lastfs)) {