|
DistroBaker |
81d7dc |
commit 9633ab52460f58c92c6daa35e9d24e4ce9c5ab1c
|
|
DistroBaker |
81d7dc |
Author: Miroslav Lichvar <mlichvar@redhat.com>
|
|
DistroBaker |
81d7dc |
Date: Tue Feb 23 11:01:43 2021 +0100
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
sk: Don't return error for zero-length messages.
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
The recvmsg() call can return zero for a zero-length UDP message, which
|
|
DistroBaker |
81d7dc |
should be handled as a bad message and not a fault of the port. This was
|
|
DistroBaker |
81d7dc |
addressed in commit 6b61ba29c78e ("Avoid fault when receiving zero
|
|
DistroBaker |
81d7dc |
length packets"), but later regressed in commit a6e0b83bd503
|
|
DistroBaker |
81d7dc |
("sk: Convey transmit path errors to the caller.").
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
|
|
DistroBaker |
81d7dc |
Fixes: a6e0b83bd503 ("sk: Convey transmit path errors to the caller.")
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
diff --git a/sk.c b/sk.c
|
|
DistroBaker |
81d7dc |
index c9ef4d2..8be0708 100644
|
|
DistroBaker |
81d7dc |
--- a/sk.c
|
|
DistroBaker |
81d7dc |
+++ b/sk.c
|
|
DistroBaker |
81d7dc |
@@ -391,7 +391,7 @@ int sk_receive(int fd, void *buf, int buflen,
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
if (!ts) {
|
|
DistroBaker |
81d7dc |
memset(&hwts->ts, 0, sizeof(hwts->ts));
|
|
DistroBaker |
81d7dc |
- return cnt < 1 ? -errno : cnt;
|
|
DistroBaker |
81d7dc |
+ return cnt < 0 ? -errno : cnt;
|
|
DistroBaker |
81d7dc |
}
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
switch (hwts->type) {
|
|
DistroBaker |
81d7dc |
@@ -407,7 +407,7 @@ int sk_receive(int fd, void *buf, int buflen,
|
|
DistroBaker |
81d7dc |
hwts->ts = timespec_to_tmv(ts[1]);
|
|
DistroBaker |
81d7dc |
break;
|
|
DistroBaker |
81d7dc |
}
|
|
DistroBaker |
81d7dc |
- return cnt < 1 ? -errno : cnt;
|
|
DistroBaker |
81d7dc |
+ return cnt < 0 ? -errno : cnt;
|
|
DistroBaker |
81d7dc |
}
|
|
DistroBaker |
81d7dc |
|
|
DistroBaker |
81d7dc |
int sk_set_priority(int fd, int family, uint8_t dscp)
|