blob: 54fc4abb672057d00ac703b52ab6f64764d86ef0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#ifndef FORTIFY_POLL_H_
#define FORTIFY_POLL_H_
#include_next <stddef.h>
#include_next <poll.h>
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && defined(__OPTIMIZE__) && __OPTIMIZE__ > 0
static inline __attribute__ ((always_inline))
int
__fortify_poll(struct pollfd *fds, nfds_t nfds, int timeout)
{
size_t bos = __builtin_object_size(fds, 0);
if (bos != -1 && nfds > bos / sizeof(struct pollfd))
__builtin_trap();
return poll(fds, nfds, timeout);
}
#undef poll
#define poll(fds, nfds, timeout) __fortify_poll(fds, nfds, timeout)
#endif
#endif
|