summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-24 21:51:54 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-10-24 21:51:54 +0200
commit50c7599ee584131e8ecb5d0742b46c7a7aeee0a9 (patch)
tree520ce37b9f490f94eec1c798254dc1b95be1626f
parent96fa1b7327b35cdeca6c77f2fdde906cabc437d8 (diff)
Properly handle socket_recv errorsHEADmaster
-rw-r--r--ot_udp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ot_udp.c b/ot_udp.c
index 8e056db..02467e1 100644
--- a/ot_udp.c
+++ b/ot_udp.c
@@ -81,9 +81,10 @@ int handle_udp6(int64_t serversocket, struct ot_workstruct *ws) {
81 uint16_t port, remoteport; 81 uint16_t port, remoteport;
82 size_t byte_count, scrape_count; 82 size_t byte_count, scrape_count;
83 83
84 byte_count = socket_recv6(serversocket, ws->inbuf, G_INBUF_SIZE, remoteip, &remoteport, &scopeid); 84 ssize_t result = socket_recv6(serversocket, ws->inbuf, G_INBUF_SIZE, remoteip, &remoteport, &scopeid);
85 if (!byte_count) 85 if (result <= 0)
86 return 0; 86 return 0;
87 byte_count = (size_t)result;
87 88
88 stats_issue_event(EVENT_ACCEPT, FLAG_UDP, (uintptr_t)remoteip); 89 stats_issue_event(EVENT_ACCEPT, FLAG_UDP, (uintptr_t)remoteip);
89 stats_issue_event(EVENT_READ, FLAG_UDP, byte_count); 90 stats_issue_event(EVENT_READ, FLAG_UDP, byte_count);