summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorLukas Slebodnik <lslebodn@redhat.com>2013-05-23 13:14:37 +0200
committerJakub Hrozek <jhrozek@redhat.com>2013-09-11 19:44:56 +0200
commitaac071824f6c98003f30d49ab440c15b4b53692c (patch)
treefe782fd74b15995483e55629c5f9e0c443fde171 /src/util
parenta4bf85ccc902490c3b75b44532010fbb32169801 (diff)
downloadsssd-aac071824f6c98003f30d49ab440c15b4b53692c.tar.gz
sssd-aac071824f6c98003f30d49ab440c15b4b53692c.tar.bz2
sssd-aac071824f6c98003f30d49ab440c15b4b53692c.zip
Enable printf format string checking
https://fedorahosted.org/sssd/ticket/1945
Diffstat (limited to 'src/util')
-rw-r--r--src/util/util.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/util/util.h b/src/util/util.h
index ff54048b..cae4a49a 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -55,13 +55,19 @@
#define CLEAR_MC_FLAG "clear_mc_flag"
+#ifdef HAVE_FUNCTION_ATTRIBUTE_FORMAT
+#define SSS_ATTRIBUTE_PRINTF(a1, a2) __attribute__ ((format (printf, a1, a2)))
+#else
+#define SSS_ATTRIBUTE_PRINTF(a1, a2)
+#endif
+
extern const char *debug_prg_name;
extern int debug_level;
extern int debug_timestamps;
extern int debug_microseconds;
extern int debug_to_file;
extern const char *debug_log_file;
-void debug_fn(const char *format, ...);
+void debug_fn(const char *format, ...) SSS_ATTRIBUTE_PRINTF(1, 2);
int debug_get_level(int old_level);
int debug_convert_old_level(int old_level);
errno_t set_debug_file_from_fd(const int fd);
@@ -274,7 +280,7 @@ void talloc_log_fn(const char *msg);
#define SSS_LOG_INFO 6 /* informational */
#define SSS_LOG_DEBUG 7 /* debug-level messages */
-void sss_log(int priority, const char *format, ...);
+void sss_log(int priority, const char *format, ...) SSS_ATTRIBUTE_PRINTF(2, 3);
/* from server.c */
struct main_context {