net: zperf: Fix invalid zsock_recv() error check

The return value can only be -1, errno value should be verified instead
for the actual error code.

Signed-off-by: Robert Lubos <robert.lubos@nordicsemi.no>
This commit is contained in:
Robert Lubos 2025-05-21 16:08:44 +02:00 committed by Benjamin Cabé
commit 02530beeda

View file

@ -118,7 +118,7 @@ static inline int zperf_upload_fin(int sock,
} }
ret = zsock_recv(sock, stats, sizeof(stats), 0); ret = zsock_recv(sock, stats, sizeof(stats), 0);
if (ret == -EAGAIN) { if (ret < 0 && errno == EAGAIN) {
NET_WARN("Stats receive timeout"); NET_WARN("Stats receive timeout");
} else if (ret < 0) { } else if (ret < 0) {
NET_ERR("Failed to receive packet (%d)", errno); NET_ERR("Failed to receive packet (%d)", errno);