shared: fix chmod in InterfaceConfig

pull/153/head
Jake McGinty 2021-09-14 17:16:16 +09:00
parent cf3510918a
commit c94d9d2c03
1 changed files with 2 additions and 5 deletions

View File

@ -1,5 +1,5 @@
use crate::{ 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 indoc::writedoc;
use ipnetwork::IpNetwork; use ipnetwork::IpNetwork;
@ -8,7 +8,6 @@ use std::{
fs::{File, OpenOptions}, fs::{File, OpenOptions},
io::{self, Write}, io::{self, Write},
net::SocketAddr, net::SocketAddr,
os::unix::fs::PermissionsExt,
path::{Path, PathBuf}, path::{Path, PathBuf},
}; };
use wgctrl::InterfaceName; use wgctrl::InterfaceName;
@ -61,9 +60,7 @@ impl InterfaceConfig {
mode: Option<u32>, mode: Option<u32>,
) -> Result<(), io::Error> { ) -> Result<(), io::Error> {
if let Some(val) = mode { if let Some(val) = mode {
let metadata = target_file.metadata()?; chmod(target_file, val)?;
let mut permissions = metadata.permissions();
permissions.set_mode(val);
} }
if comments { if comments {