From bf99940f649959fcc73590c043d28b1ab0d83e1c Mon Sep 17 00:00:00 2001 From: Sami Kerola Date: Thu, 3 May 2018 22:57:57 +0100 Subject: 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 Signed-off-by: Karel Zak --- include/pathnames.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/pathnames.h') 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" -- cgit v1.2.3-55-g7522