From 7212959240ea8a73671d234c8b61ac81ca775b26 Mon Sep 17 00:00:00 2001 From: sin Date: Sat, 28 Feb 2015 16:01:26 +0000 Subject: Use __typeof__(sizeof 0) trickery We cannot pull stddef.h and since fortify already relies on GCC features we can use the above typeof trick to get a usable size_t. --- include/poll.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/poll.h b/include/poll.h index cbc78fd..83801bd 100644 --- a/include/poll.h +++ b/include/poll.h @@ -9,9 +9,9 @@ static inline __attribute__ ((always_inline)) int __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout) { + __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); - if (__builtin_object_size(fds, 0) != -1 && - nfds > __builtin_object_size(fds, 0) / sizeof(struct pollfd)) + if (bos != -1 && nfds > bos / sizeof(struct pollfd)) __builtin_trap(); return poll(fds, nfds, timeout); } -- cgit v1.3