summaryrefslogtreecommitdiff
path: root/libgcompat
diff options
context:
space:
mode:
authorElizabeth Myers <elizabeth@interlinked.me>2018-04-03 03:17:11 -0500
committerElizabeth Myers <elizabeth@interlinked.me>2018-04-03 03:17:11 -0500
commit1505c62342e2a282fa7ab855b8d898084dddced6 (patch)
tree24a2dbe125985040aaefb5e71121e38a7646b014 /libgcompat
parentc80521d4978910af745894b123a48c24e0dca86c (diff)
downloadgcompat-1505c62342e2a282fa7ab855b8d898084dddced6.tar.gz
gcompat-1505c62342e2a282fa7ab855b8d898084dddced6.tar.bz2
gcompat-1505c62342e2a282fa7ab855b8d898084dddced6.tar.xz
gcompat-1505c62342e2a282fa7ab855b8d898084dddced6.zip
socket: __poll_chk
Diffstat (limited to 'libgcompat')
-rw-r--r--libgcompat/socket.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libgcompat/socket.c b/libgcompat/socket.c
index 971a6ba..49da09d 100644
--- a/libgcompat/socket.c
+++ b/libgcompat/socket.c
@@ -39,3 +39,16 @@ ssize_t __recvfrom_chk(int fd, void *buf, size_t len, size_t buflen, int flags,
return recvfrom(fd, buf, len, flags, address, address_len);
}
+
+/**
+ * Checked version of poll, not in LSB but found in the wild.
+ *
+ * This checks if the size of fds is large enough to hold all the fd's claimed
+ * in nfds.
+ */
+int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen)
+{
+ assert((fdslen / sizeof(*fds)) < nfds);
+
+ return poll(fds, nfds, timeout);
+}