From 5edd3f240b7724fab04d12d45ebec0b5a8bdbf1d Mon Sep 17 00:00:00 2001 From: Dmitry Sharshakov Date: Fri, 15 Dec 2023 20:44:21 +0300 Subject: [PATCH] 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 --- spa/plugins/support/node-driver.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spa/plugins/support/node-driver.c b/spa/plugins/support/node-driver.c index 1df866f77..af6505724 100644 --- a/spa/plugins/support/node-driver.c +++ b/spa/plugins/support/node-driver.c @@ -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) {