mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-03 06:47:04 -04:00
module-avb: check that PTP management response is complete
This commit is contained in:
parent
6c43bdfa85
commit
07533eb590
1 changed files with 7 additions and 1 deletions
|
|
@ -114,11 +114,17 @@ static bool update_ts_refclk(struct gptp *gptp) {
|
|||
}
|
||||
|
||||
uint8_t buf[sizeof(struct ptp_management_msg) + sizeof(struct ptp_parent_data_set)];
|
||||
if (read(gptp->ptp_fd, &buf, sizeof(buf)) == -1) {
|
||||
ssize_t ret = read(gptp->ptp_fd, &buf, sizeof(buf));
|
||||
if (ret == -1) {
|
||||
pw_log_warn("Failed to receive PTP management response: %m");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (ret != sizeof(buf)) {
|
||||
pw_log_warn("Received incomplete PTP management response: %m");
|
||||
return false;
|
||||
}
|
||||
|
||||
struct ptp_management_msg res = *(struct ptp_management_msg *)buf;
|
||||
struct ptp_parent_data_set parent =
|
||||
*(struct ptp_parent_data_set *)(buf + sizeof(struct ptp_management_msg));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue