git: sbin/hammer2: Fix -Werror=format-truncation= warning

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Sun Oct 8 01:52:05 PDT 2023


commit 7947b1995bcae4fab571d43acdcc3d441f05beb2
Author: Tomohiro Kusumi <tkusumi at netbsd.org>
Date:   Sat Oct 7 03:34:46 2023 -0700

    sbin/hammer2: Fix -Werror=format-truncation= warning
    
    The first snprintf is formatting a potentially longer string into
    a smaller buffer. Expanding filename[] size to larger than pfs.name[]
    fixes a format-truncation warning, but that generates a second
    format-truncation warning on formatting the string back to pfs.name[]
    in the second snprintf. The second snprintf can be done with strlcpy.

Summary of changes:
 sbin/hammer2/cmd_snapshot.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/7947b1995bcae4fab571d43acdcc3d441f05beb2


-- 
DragonFly BSD source repository


More information about the Commits mailing list