[PATCH 13/19] include: define format to be constant in xasprintf()

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

 



Add also format function attribute to add robustness.

Signed-off-by: Sami Kerola <kerolasa@xxxxxx>
---
 include/xalloc.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/xalloc.h b/include/xalloc.h
index 8c22ff7..1704259 100644
--- a/include/xalloc.h
+++ b/include/xalloc.h
@@ -63,7 +63,8 @@ static inline char *xstrdup(const char *str)
         return ret;
 }
 
-static inline int xasprintf(char **strp, char *fmt, ...)
+static inline int __attribute__ ((__format__(printf, 2, 3)))
+    xasprintf(char **strp, const char *fmt, ...)
 {
 	int ret;
 	va_list args;
-- 
1.7.11.3

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux