From 0c90ff1429deaa556c0509c13cdd5aef5df9c0d4 Mon Sep 17 00:00:00 2001 From: Vasil Dimov Date: Wed, 7 Apr 2021 11:02:25 +0200 Subject: [PATCH] fuzz: set errno from FuzzedSock::Wait() if it simulates a failure --- src/test/fuzz/util.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/fuzz/util.cpp b/src/test/fuzz/util.cpp index 2da0e84116..9ab7145b8a 100644 --- a/src/test/fuzz/util.cpp +++ b/src/test/fuzz/util.cpp @@ -9,7 +9,13 @@ bool FuzzedSock::Wait(std::chrono::milliseconds timeout, Event requested, Event* occurred) const { + constexpr std::array wait_errnos{ + EBADF, + EINTR, + EINVAL, + }; if (!m_fuzzed_data_provider.ConsumeBool()) { + SetFuzzedErrNo(m_fuzzed_data_provider, wait_errnos); return false; } if (occurred) *occurred = 0;