aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-utils/src
diff options
context:
space:
mode:
authorJae-Heon Ji <32578710+jaeheonji@users.noreply.github.com>2022-04-16 16:11:46 +0900
committerGitHub <noreply@github.com>2022-04-16 16:11:46 +0900
commitf2a7e73687a3fbdce3ee8ace63f4b741239fd41d (patch)
tree132f0f378bb7ee414eb4544532551f19885eb685 /zellij-utils/src
parentdocs(changelog): copy_on_select option (diff)
downloadsl0ppij-f2a7e73687a3fbdce3ee8ace63f4b741239fd41d.tar.gz
sl0ppij-f2a7e73687a3fbdce3ee8ace63f4b741239fd41d.tar.xz
sl0ppij-f2a7e73687a3fbdce3ee8ace63f4b741239fd41d.zip
fix: minor system improvements (#1328)
Diffstat (limited to 'zellij-utils/src')
-rw-r--r--zellij-utils/src/consts.rs2
-rw-r--r--zellij-utils/src/logging.rs6
-rw-r--r--zellij-utils/src/shared.rs6
3 files changed, 6 insertions, 8 deletions
diff --git a/zellij-utils/src/consts.rs b/zellij-utils/src/consts.rs
index cd318002..39d125c7 100644
--- a/zellij-utils/src/consts.rs
+++ b/zellij-utils/src/consts.rs
@@ -46,7 +46,7 @@ lazy_static! {
pub static ref ZELLIJ_IPC_PIPE: PathBuf = {
let mut sock_dir = ZELLIJ_SOCK_DIR.clone();
fs::create_dir_all(&sock_dir).unwrap();
- set_permissions(&sock_dir).unwrap();
+ set_permissions(&sock_dir, 0o700).unwrap();
sock_dir.push(envs::get_session_name().unwrap());
sock_dir
};
diff --git a/zellij-utils/src/logging.rs b/zellij-utils/src/logging.rs
index 31b4441f..b9746fc9 100644
--- a/zellij-utils/src/logging.rs
+++ b/zellij-utils/src/logging.rs
@@ -70,7 +70,7 @@ pub fn atomic_create_file(file_name: &Path) -> io::Result<()> {
.append(true)
.create(true)
.open(file_name)?;
- set_permissions(file_name)
+ set_permissions(file_name, 0o600)
}
pub fn atomic_create_dir(dir_name: &Path) -> io::Result<()> {
@@ -84,7 +84,7 @@ pub fn atomic_create_dir(dir_name: &Path) -> io::Result<()> {
Ok(())
};
if result.is_ok() {
- set_permissions(dir_name)?;
+ set_permissions(dir_name, 0o700)?;
}
result
}
@@ -98,6 +98,6 @@ pub fn debug_to_file(message: &[u8], pid: RawFd) -> io::Result<()> {
.append(true)
.create(true)
.open(&path)?;
- set_permissions(&path)?;
+ set_permissions(&path, 0o600)?;
file.write_all(message)
}
diff --git a/zellij-utils/src/shared.rs b/zellij-utils/src/shared.rs
index 295d8c5b..0f975682 100644
--- a/zellij-utils/src/shared.rs
+++ b/zellij-utils/src/shared.rs
@@ -11,11 +11,9 @@ use strip_ansi_escapes::strip;
use unicode_width::UnicodeWidthStr;
use zellij_tile::data::{Palette, PaletteColor, PaletteSource, ThemeHue};
-const UNIX_PERMISSIONS: u32 = 0o700;
-
-pub fn set_permissions(path: &Path) -> io::Result<()> {
+pub fn set_permissions(path: &Path, mode: u32) -> io::Result<()> {
let mut permissions = fs::metadata(path)?.permissions();
- permissions.set_mode(UNIX_PERMISSIONS);
+ permissions.set_mode(mode);
fs::set_permissions(path, permissions)
}