scoutfs: check snprintf_key() format args

Add the function attribute to snprintf_key() to have the compiler verify
its print format and args.  I noticed some buggy changes that didn't
throw errors.  Happily none of the existing calls had problems.

Signed-off-by: Zach Brown <zab@versity.com>
This commit is contained in:
Zach Brown
2018-03-12 15:31:39 -07:00
committed by Zach Brown
parent 0b54d71b98
commit 9f51b63f8d

View File

@@ -128,9 +128,10 @@ void scoutfs_key_dec(struct scoutfs_key_buf *key)
* formatting to represent the trailing bytes: runs of zeros compresesd
* to _ and then hex output of non-zero bytes.
*/
static int snprintf_key(char *buf, size_t size, struct scoutfs_key_buf *key,
unsigned min_len, unsigned fmt_len,
const char *fmt, ...)
static int __printf(6, 7) snprintf_key(char *buf, size_t size,
struct scoutfs_key_buf *key,
unsigned min_len, unsigned fmt_len,
const char *fmt, ...)
{
va_list args;