From c94d9d2c0340371580a78ccfc5075977cd00573c Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Tue, 14 Sep 2021 17:16:16 +0900 Subject: [PATCH] shared: fix chmod in InterfaceConfig --- shared/src/interface_config.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/shared/src/interface_config.rs b/shared/src/interface_config.rs index 657fc24..b042d1d 100644 --- a/shared/src/interface_config.rs +++ b/shared/src/interface_config.rs @@ -1,5 +1,5 @@ use crate::{ - ensure_dirs_exist, Endpoint, Error, IoErrorContext, WrappedIoError, CLIENT_CONFIG_DIR, + chmod, ensure_dirs_exist, Endpoint, Error, IoErrorContext, WrappedIoError, CLIENT_CONFIG_DIR, }; use indoc::writedoc; use ipnetwork::IpNetwork; @@ -8,7 +8,6 @@ use std::{ fs::{File, OpenOptions}, io::{self, Write}, net::SocketAddr, - os::unix::fs::PermissionsExt, path::{Path, PathBuf}, }; use wgctrl::InterfaceName; @@ -61,9 +60,7 @@ impl InterfaceConfig { mode: Option, ) -> Result<(), io::Error> { if let Some(val) = mode { - let metadata = target_file.metadata()?; - let mut permissions = metadata.permissions(); - permissions.set_mode(val); + chmod(target_file, val)?; } if comments {