summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@opensourcerouting.org>2024-10-16 12:56:45 +0200
committerDavid Lamparter <equinox@opensourcerouting.org>2024-10-16 13:30:25 +0200
commitb5f196c35a6d24a826fc087ce9de04af88ffb42b (patch)
tree70b352754813394b1d7fc0218a12dd57d37f173a
parente6cb1a90f2fbeab421c79d2a740225413b3238ac (diff)
bgpd: hide read() call from clang-SA
Sigh. clang-SA doesn't want you to call read() while holding a mutex. Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
-rw-r--r--bgpd/bgp_io.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/bgpd/bgp_io.c b/bgpd/bgp_io.c
index b07e69ac31..9e9251c854 100644
--- a/bgpd/bgp_io.c
+++ b/bgpd/bgp_io.c
@@ -512,7 +512,13 @@ static uint16_t bgp_read(struct peer_connection *connection, int *code_p)
readsize = MIN(ibuf_work_space, sizeof(ibuf_scratch));
+#ifdef __clang_analyzer__
+ /* clang-SA doesn't want you to call read() while holding a mutex */
+ (void)readsize;
+ nbytes = 0;
+#else
nbytes = read(connection->fd, ibuf_scratch, readsize);
+#endif
/* EAGAIN or EWOULDBLOCK; come back later */
if (nbytes < 0 && ERRNO_IO_RETRY(errno)) {