diff options
Diffstat (limited to 'include/unistd.h')
| -rw-r--r-- | include/unistd.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h index 3e5c040..4c18b73 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
| @@ -158,6 +158,22 @@ _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, | |||
| 158 | return __orig_write(__f, __s, __n); | 158 | return __orig_write(__f, __s, __n); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) || defined(_BSD_SOURCE) | ||
| 162 | #undef swab | ||
| 163 | |||
| 164 | _FORTIFY_FN(swab) void swab(const void * _FORTIFY_POS0 __os, | ||
| 165 | void * _FORTIFY_POS0 __od, ssize_t __n) | ||
| 166 | { | ||
| 167 | size_t __bs = __bos(__os, 0); | ||
| 168 | size_t __bd = __bos(__od, 0); | ||
| 169 | |||
| 170 | if ((size_t)__n > __bs || (size_t)__n > __bd) | ||
| 171 | __builtin_trap(); | ||
| 172 | return __orig_swab(__os, __od, __n); | ||
| 173 | } | ||
| 174 | |||
| 175 | #endif | ||
| 176 | |||
| 161 | #ifdef __cplusplus | 177 | #ifdef __cplusplus |
| 162 | } | 178 | } |
| 163 | #endif | 179 | #endif |
