node-driver: open PHC as readonly

RW access is usually denied to a user unit. RO might be as well but it's more safe to make /dev/ptpX just user-readable
This commit is contained in:
Dmitry Sharshakov 2023-12-15 20:44:21 +03:00 committed by Wim Taymans
parent fffda6b6d1
commit 5edd3f240b

View file

@ -588,7 +588,7 @@ impl_init(const struct spa_handle_factory *factory,
if (this->clock_fd >= 0) {
close(this->clock_fd);
}
this->clock_fd = open(s, O_RDWR);
this->clock_fd = open(s, O_RDONLY);
if (this->clock_fd == -1) {
spa_log_warn(this->log, "failed to open clock device '%s'", s);
@ -602,7 +602,7 @@ impl_init(const struct spa_handle_factory *factory,
} else {
char dev[19];
spa_scnprintf(dev, sizeof(dev), "/dev/ptp%d", phc_index);
this->clock_fd = open(dev, O_RDWR);
this->clock_fd = open(dev, O_RDONLY);
}
if (this->clock_fd == -1) {