[PATCH 2/2] Use format attribute to silence -Wformat-nonliteral warnings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This will also cause the compiler to add checks to ensure the
arguments are consistent with the printf format.
---
 support/nfsidmap/libnfsidmap.c | 2 +-
 utils/gssd/err_util.c          | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/support/nfsidmap/libnfsidmap.c b/support/nfsidmap/libnfsidmap.c
index bce448cf..5d551e4f 100644
--- a/support/nfsidmap/libnfsidmap.c
+++ b/support/nfsidmap/libnfsidmap.c
@@ -94,7 +94,7 @@ gid_t nobody_gid = (gid_t)-1;
 #endif
 
 /* Default logging fuction */
-static void default_logger(const char *fmt, ...)
+__attribute__ ((format (printf, 1, 2))) static void default_logger(const char *fmt, ...)
 {
 	va_list vp;
 
diff --git a/utils/gssd/err_util.c b/utils/gssd/err_util.c
index 2b1132ac..7179cc02 100644
--- a/utils/gssd/err_util.c
+++ b/utils/gssd/err_util.c
@@ -50,7 +50,7 @@ void initerr(char *progname, int set_verbosity, int set_fg)
 }
 
 
-void printerr(int priority, char *format, ...)
+__attribute__ ((format (printf, 2, 3))) void printerr(int priority, char *format, ...)
 {
 	va_list args;
 
-- 
2.25.3




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux