diff options
| author | sin | 2015-02-28 16:01:26 +0000 |
|---|---|---|
| committer | sin | 2015-02-28 16:01:26 +0000 |
| commit | 7212959240ea8a73671d234c8b61ac81ca775b26 (patch) | |
| tree | 6de1c424ece3055bc3dbf2378a1f5943284019f2 | |
| parent | 4672406edd54ffe1466cdcb4b36c849e7245d603 (diff) | |
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.
| -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 cbc78fd..83801bd 100644 --- a/include/poll.h +++ b/include/poll.h | |||
| @@ -9,9 +9,9 @@ static inline __attribute__ ((always_inline)) | |||
| 9 | int | 9 | int |
| 10 | __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout) | 10 | __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout) |
| 11 | { | 11 | { |
| 12 | __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0); | ||
| 12 | 13 | ||
| 13 | if (__builtin_object_size(fds, 0) != -1 && | 14 | if (bos != -1 && nfds > bos / sizeof(struct pollfd)) |
| 14 | nfds > __builtin_object_size(fds, 0) / sizeof(struct pollfd)) | ||
| 15 | __builtin_trap(); | 15 | __builtin_trap(); |
| 16 | return poll(fds, nfds, timeout); | 16 | return poll(fds, nfds, timeout); |
| 17 | } | 17 | } |
