diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/unistd.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/unistd.h b/include/unistd.h index 1c79711..e91f922 100644 --- a/include/unistd.h +++ b/include/unistd.h | |||
| @@ -180,6 +180,17 @@ _FORTIFY_FN(write) ssize_t write(int __f, const void * _FORTIFY_POS0 __s, | |||
| 180 | return __orig_write(__f, __s, __n); | 180 | return __orig_write(__f, __s, __n); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | __diagnose_as_builtin(__builtin_pwrite, 1, 2, 3, 4) | ||
| 184 | _FORTIFY_FN(pwrite) ssize_t pwrite(int __f, const void * _FORTIFY_POS0 __s, | ||
| 185 | size_t __n, off_t __o) | ||
| 186 | { | ||
| 187 | size_t __b = __bos(__s, 0); | ||
| 188 | |||
| 189 | if (__n > __b) | ||
| 190 | __builtin_trap(); | ||
| 191 | return __orig_pwrite(__f, __s, __n, __o); | ||
| 192 | } | ||
| 193 | |||
| 183 | #ifdef __cplusplus | 194 | #ifdef __cplusplus |
| 184 | } | 195 | } |
| 185 | #endif | 196 | #endif |
