diff options
| author | jvoisin | 2023-03-18 14:01:02 +0100 |
|---|---|---|
| committer | jvoisin | 2025-10-31 22:16:21 +0100 |
| commit | 249492e08adbf034976770ab3b021ba093a2ab18 (patch) | |
| tree | cd04ae414fa7ef646a31f767b9295946fd2c9987 /include/poll.h | |
| parent | e3fee64643279c144efd3d6856ed4e818c0d5ca2 (diff) | |
Make use of __builtin_dynamic_object_size
GCC and Clang provide __builtin_dynamic_object_size
(see documentation: https://gcc.gnu.org/onlinedocs/gcc/Object-Size-Checking.html),
so we should make use of it when its available.
Diffstat (limited to 'include/poll.h')
| -rw-r--r-- | include/poll.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/poll.h b/include/poll.h index 24691f1..cf1b9e5 100644 --- a/include/poll.h +++ b/include/poll.h | |||
| @@ -32,7 +32,7 @@ extern "C" { | |||
| 32 | 32 | ||
| 33 | _FORTIFY_FN(poll) int poll(struct pollfd *__f, nfds_t __n, int __s) | 33 | _FORTIFY_FN(poll) int poll(struct pollfd *__f, nfds_t __n, int __s) |
| 34 | { | 34 | { |
| 35 | __typeof__(sizeof 0) __b = __builtin_object_size(__f, 0); | 35 | __typeof__(sizeof 0) __b = __bos(__f, 0); |
| 36 | 36 | ||
| 37 | if (__n > __b / sizeof(struct pollfd)) | 37 | if (__n > __b / sizeof(struct pollfd)) |
| 38 | __builtin_trap(); | 38 | __builtin_trap(); |
| @@ -44,7 +44,7 @@ _FORTIFY_FN(poll) int poll(struct pollfd *__f, nfds_t __n, int __s) | |||
| 44 | _FORTIFY_FN(ppoll) int ppoll(struct pollfd *__f, nfds_t __n, const struct timespec *__s, | 44 | _FORTIFY_FN(ppoll) int ppoll(struct pollfd *__f, nfds_t __n, const struct timespec *__s, |
| 45 | const sigset_t *__m) | 45 | const sigset_t *__m) |
| 46 | { | 46 | { |
| 47 | __typeof__(sizeof 0) __b = __builtin_object_size(__f, 0); | 47 | __typeof__(sizeof 0) __b = __bos(__f, 0); |
| 48 | 48 | ||
| 49 | if (__n > __b / sizeof(struct pollfd)) | 49 | if (__n > __b / sizeof(struct pollfd)) |
| 50 | __builtin_trap(); | 50 | __builtin_trap(); |
