summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/wchar.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/wchar.h b/include/wchar.h
index 78485c0..916e91a 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -147,10 +147,12 @@ __fortify_wcsrtombs(char *d, const wchar_t **s, size_t n,
147 mbstate_t *st) 147 mbstate_t *st)
148{ 148{
149 size_t bos = __builtin_object_size(d, 0); 149 size_t bos = __builtin_object_size(d, 0);
150 size_t r;
150 151
151 if (n > bos) 152 r = wcsrtombs(d, s, n > bos ? bos : n, st);
153 if (bos < n && d && *s && r != (size_t)-1)
152 __builtin_trap(); 154 __builtin_trap();
153 return wcsrtombs(d, s, n, st); 155 return r;
154} 156}
155 157
156static inline __attribute__ ((always_inline)) 158static inline __attribute__ ((always_inline))