DragonFlyBSD/src c5122b6sbin/hammer2 cmd_snapshot.c

sbin/hammer2: Silence -Wformat-truncation= warning on Linux (gcc 7.3)

filename[HAMMER2_INODE_MAXNAME] may not be sufficient if
snprintf source pfs.name string is large enough. To silence
the warning, filename[] needs another 16 bytes.

This doesn't make difference on runtime, because bytes beyond
sizeof(pfs.name) won't be used even if strlen(pfs.name) is
large enough that filename[] contents exceeds sizeof(pfs.name).

(i.e. end result of pfs.name may be incomplete with or without
this commit)

--
cmd_snapshot.c: In function 'cmd_pfs_snapshot':
cmd_snapshot.c:84:9: warning: '%04d' directive output may be truncated writing between 4 and 11 bytes into a region of size between 0 and 255 [-Wformat-truncation=]
     "%s.%04d%02d%02d.%02d%02d%02d",
         ^~~~
cmd_snapshot.c:83:3: note: 'snprintf' output between 17 and 324 bytes into a destination of size 256
   snprintf(filename, sizeof(filename),
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     "%s.%04d%02d%02d.%02d%02d%02d",
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     pfs.name,
     ~~~~~~~~~
     tp->tm_year + 1900,
     ~~~~~~~~~~~~~~~~~~~
     tp->tm_mon + 1,
     ~~~~~~~~~~~~~~~
     tp->tm_mday,
     ~~~~~~~~~~~~
     tp->tm_hour,
     ~~~~~~~~~~~~
     tp->tm_min,
     ~~~~~~~~~~~
     tp->tm_sec);
     ~~~~~~~~~~~
DeltaFile
+1-1sbin/hammer2/cmd_snapshot.c
+1-11 files

UnifiedSplitRaw