git: sbin/hammer: Fix compile warning on Linux

Tomohiro Kusumi tkusumi at crater.dragonflybsd.org
Fri Feb 16 09:02:39 PST 2018


commit 5f87bdedfbeef14602ae9bfff910fb1ca2278b63
Author: Tomohiro Kusumi <kusumi.tomohiro at gmail.com>
Date:   Sat Feb 17 10:49:39 2018 +0900

    sbin/hammer: Fix compile warning on Linux
    
    Warned by gcc 7.3.1 in Fedora.
    Extend the size of destination string.
    dirent::d_name[] is 256 bytes in Linux (and *BSD).
    
    --
    cmd_abort.c: In function 'hammer_cmd_abort_cleanup':
    cmd_abort.c:73:44: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 55 [-Wformat-truncation=]
        snprintf (pidfile, PIDFILE_BUFSIZE, "%s/%s",
                                                ^~
    cmd_abort.c:73:4: note: 'snprintf' output between 10 and 265 bytes into a destination of size 64
        snprintf (pidfile, PIDFILE_BUFSIZE, "%s/%s",
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         pidfile_loc, den->d_name);
         ~~~~~~~~~~~~~~~~~~~~~~~~~

Summary of changes:
 sbin/hammer/hammer.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff/5f87bdedfbeef14602ae9bfff910fb1ca2278b63


-- 
DragonFly BSD source repository



More information about the Commits mailing list