From 9578fadae2573b5e69370a544ec8a5d107d194f6 Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Fri, 15 May 2020 20:01:13 +0200 Subject: [PATCH] libc: handle nullptr timeout in 'ppoll()' Fixes #3790 --- repos/libports/src/lib/libc/poll.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/repos/libports/src/lib/libc/poll.cc b/repos/libports/src/lib/libc/poll.cc index 177a369f15..b75bd5c851 100644 --- a/repos/libports/src/lib/libc/poll.cc +++ b/repos/libports/src/lib/libc/poll.cc @@ -124,7 +124,9 @@ int ppoll(struct pollfd fds[], nfds_t nfds, const struct timespec *timeout, const sigset_t*) { - int timeout_ms = timeout->tv_sec * 1000 + timeout->tv_nsec / 1000; + int timeout_ms = timeout ? + (timeout->tv_sec * 1000 + timeout->tv_nsec / 1000) : + -1; return poll(fds, nfds, timeout_ms); }