diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2016-11-18 10:05:12 -0500 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2017-02-26 14:15:14 -0500 |
commit | 4638dfc1fee80f9338f2941f3cccb17bec63989a (patch) | |
tree | 7955fb0600daaa6b71bf099c4371d7548b2437bc /libglusterfs/src/statedump.h | |
parent | ece5f66a3d05628bb1a74833ae695443e079f80d (diff) | |
download | glusterfs-4638dfc1fee80f9338f2941f3cccb17bec63989a.tar.gz glusterfs-4638dfc1fee80f9338f2941f3cccb17bec63989a.tar.xz glusterfs-4638dfc1fee80f9338f2941f3cccb17bec63989a.zip |
events: use attribute(format(/printf)) to catch fmt string errors
and statedump too. Also "const char *" (versus just "char *") for the
fmt param.
Change-Id: Ic63734a673208a2cd49aebccce7659816e6179e3
BUG: 1399196
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: https://review.gluster.org/15881
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs/src/statedump.h')
-rw-r--r-- | libglusterfs/src/statedump.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libglusterfs/src/statedump.h b/libglusterfs/src/statedump.h index 39a68bd69d..0a7a97e10d 100644 --- a/libglusterfs/src/statedump.h +++ b/libglusterfs/src/statedump.h @@ -37,13 +37,13 @@ typedef struct gf_dump_options_ { extern gf_dump_options_t dump_options; -static inline -void _gf_proc_dump_build_key (char *key, const char *prefix, char *fmt,...) +__attribute__ ((__format__ (__printf__, 3, 4))) +static inline void +_gf_proc_dump_build_key (char *key, const char *prefix, const char *fmt, ...) { - char buf[GF_DUMP_MAX_BUF_LEN]; + char buf[GF_DUMP_MAX_BUF_LEN] = { 0, }; va_list ap; - memset(buf, 0, sizeof(buf)); va_start(ap, fmt); vsnprintf(buf, GF_DUMP_MAX_BUF_LEN, fmt, ap); va_end(ap); |