commit 31f2952bc70bc521e3392a9465a306dbb1dd1b38
parent bcc398c14af23c2d640d6fbbc6330d64e5ffad58
Author: sin <sin@2f30.org>
Date: Wed, 28 Jan 2015 17:15:56 +0000
Use local _n to avoid multiple evaluation
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/stdio.h b/include/stdio.h
@@ -24,9 +24,9 @@ int __fortify_vsnprintf(char *__restrict s, size_t n, const char *__restrict fmt
#define snprintf(s, n, fmt, ...) ({ \
size_t _n = (n); \
size_t bos = __builtin_object_size(s, 0); \
- if (n > bos) \
+ if (_n > bos) \
__builtin_trap(); \
- snprintf(s, n, fmt, __VA_ARGS__); \
+ snprintf(s, _n, fmt, __VA_ARGS__); \
})
#endif