ksud: don't create dir when read

This commit is contained in:
weishu
2023-07-01 19:01:09 +08:00
parent 971f59c11e
commit 839b318785

View File

@@ -12,7 +12,6 @@ pub fn set_sepolicy(pkg: String, policy: String) -> Result<()> {
} }
pub fn get_sepolicy(pkg: String) -> Result<()> { pub fn get_sepolicy(pkg: String) -> Result<()> {
ensure_dir_exists(defs::PROFILE_SELINUX_DIR)?;
let policy_file = Path::new(defs::PROFILE_SELINUX_DIR).join(pkg); let policy_file = Path::new(defs::PROFILE_SELINUX_DIR).join(pkg);
let policy = std::fs::read_to_string(policy_file)?; let policy = std::fs::read_to_string(policy_file)?;
println!("{policy}"); println!("{policy}");
@@ -27,7 +26,6 @@ pub fn set_template(name: String, template: String) -> Result<()> {
} }
pub fn get_template(name: String) -> Result<()> { pub fn get_template(name: String) -> Result<()> {
ensure_dir_exists(defs::PROFILE_TEMPLATE_DIR)?;
let template_file = Path::new(defs::PROFILE_TEMPLATE_DIR).join(name); let template_file = Path::new(defs::PROFILE_TEMPLATE_DIR).join(name);
let template = std::fs::read_to_string(template_file)?; let template = std::fs::read_to_string(template_file)?;
println!("{template}"); println!("{template}");