summaryrefslogtreecommitdiff
path: root/include/linux/kernel.h
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-02-18 04:49:34 -0800
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-02-18 04:49:34 -0800
commit01d1a791d1a13df17b649459eec6830f226c7163 (patch)
tree851c48c86a683ab46e89b9fff7b4fc9eba36cde1 /include/linux/kernel.h
parent53b15b863e95defe1487a67e6ca5502a0b4d3e5f (diff)
[PATCH] snprintf fixes
From: Juergen Quade <quade@hsnr.de> Lots of places in the kernel are using [v]snprintf wrongly: they assume it returns the number of characters copied. It doesn't. It returns the number of characters which _would_ have been copied had the buffer not been filled up. So create new functions vscnprintf() and scnprintf() which have the expected (sane) semaptics, and migrate callers over to using them.
Diffstat (limited to 'include/linux/kernel.h')
-rw-r--r--include/linux/kernel.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index 228182715b1d..0e13d9677b8f 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -72,6 +72,9 @@ extern int vsprintf(char *buf, const char *, va_list);
extern int snprintf(char * buf, size_t size, const char * fmt, ...)
__attribute__ ((format (printf, 3, 4)));
extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
+extern int scnprintf(char * buf, size_t size, const char * fmt, ...)
+ __attribute__ ((format (printf, 3, 4)));
+extern int vscnprintf(char *buf, size_t size, const char *fmt, va_list args);
extern int sscanf(const char *, const char *, ...)
__attribute__ ((format (scanf,2,3)));