summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsin2015-03-03 14:28:25 +0000
committersin2015-03-03 14:28:25 +0000
commit7279c33202a77972301aa367667de9207f360c1b (patch)
tree408fcc4d9bfeac8e6178ce25500fbc66878833ad
parent15c2b9d8df9c4a2959abe5dee488f741f9aeb223 (diff)
Add ppoll() check
-rw-r--r--include/poll.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/poll.h b/include/poll.h
index 4eb2713..8810bca 100644
--- a/include/poll.h
+++ b/include/poll.h
@@ -16,9 +16,28 @@ __fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout)
16 return poll(fds, nfds, timeout); 16 return poll(fds, nfds, timeout);
17} 17}
18 18
19#ifdef _GNU_SOURCE
20int
21__fortify_ppoll(struct pollfd *fds, nfds_t nfds,
22 const struct timespec *timeout, const sigset_t *mask)
23{
24 __typeof__(sizeof 0) bos = __builtin_object_size(fds, 0);
25
26 if (nfds > bos / sizeof(struct pollfd))
27 __builtin_trap();
28 return ppoll(fds, nfds, timeout, mask);
29}
30
31#endif
32
19#undef poll 33#undef poll
20#define poll(fds, nfds, timeout) __fortify_poll(fds, nfds, timeout) 34#define poll(fds, nfds, timeout) __fortify_poll(fds, nfds, timeout)
21 35
36#ifdef _GNU_SOURCE
37#undef ppoll
38#define ppoll(fds, nfds, timeout, mask) __fortify_ppoll(fds, nfds, timeout, mask)
39#endif
40
22#endif 41#endif
23 42
24#endif 43#endif