Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Fix shell freeze #145

Merged
merged 1 commit into from
Jan 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion wpa_supplicant/ctrl_iface_zephyr.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,20 @@ static void wpa_supplicant_ctrl_iface_receive(int sock, void *eloop_ctx,
size_t reply_len = 0;

buf = os_zalloc(CTRL_IFACE_MAX_LEN + 1);
if (!buf)
if (!buf) {
/* Do a dummy read to drain the data from the socket */
static unsigned char dummy[512];

/* This is expected in OOM conditions, so, do not spam the log */
wpa_printf(MSG_DEBUG, "Failed to allocate memory for ctrl_iface receive buffer");

do {
res = recv(sock, dummy, sizeof(dummy),
MSG_TRUNC | MSG_DONTWAIT);
} while (res > 0);
return;
}

res = recv(sock, buf, CTRL_IFACE_MAX_LEN, 0);
if (res < 0) {
wpa_printf(MSG_ERROR, "recvfrom(ctrl_iface): %s",
Expand Down
Loading