diff options
author | Sami Kerola | 2018-05-03 23:57:57 +0200 |
---|---|---|
committer | Karel Zak | 2018-05-10 11:20:56 +0200 |
commit | bf99940f649959fcc73590c043d28b1ab0d83e1c (patch) | |
tree | 678325ccfd9a2c12d981163f5da0b6d131656df5 /include | |
parent | dmesg: link together with syslog(2) manual page (diff) | |
download | kernel-qcow2-util-linux-bf99940f649959fcc73590c043d28b1ab0d83e1c.tar.gz kernel-qcow2-util-linux-bf99940f649959fcc73590c043d28b1ab0d83e1c.tar.xz kernel-qcow2-util-linux-bf99940f649959fcc73590c043d28b1ab0d83e1c.zip |
lib/canonicalize: fix truncation warning
lib/canonicalize.c: In function ‘canonicalize_dm_name’:
lib/canonicalize.c:42:45: warning: ‘%s’ directive output may be truncated
writing up to 255 bytes into a region of size 244 [-Wformat-truncation=]
snprintf(path, sizeof(path), "/dev/mapper/%s", name);
Notice that this warnign fix does not improve code enormously. The earlier
snprintf() truncation will not happen a bit earlier when fgets() is called.
In that sense this change merely makes one easy to silence warning to
disappear, and therefore improve change of noticing useful messaging as such
crops up.
[kzak@redhat.com: - use macro rather than hardcoded string for mapper path]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/pathnames.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/pathnames.h b/include/pathnames.h index 59cc66736..abf0cdee9 100644 --- a/include/pathnames.h +++ b/include/pathnames.h @@ -131,6 +131,8 @@ # define _PATH_DEV "/dev/" #endif +#define _PATH_DEV_MAPPER "/dev/mapper" + #define _PATH_DEV_MEM "/dev/mem" #define _PATH_DEV_LOOP "/dev/loop" |