From 4e6724212014d171f5096e0f2e72f0771e67dc23 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 22 Dec 2020 22:33:22 +0000 Subject: [PATCH] wip tmpdir setup Signed-off-by: Ian Jackson --- wdriver.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wdriver.rs b/wdriver.rs index 40ba3955..0bf4b476 100644 --- a/wdriver.rs +++ b/wdriver.rs @@ -59,7 +59,7 @@ fn prepare_tmpdir(opts: &Opts, current_exe: &str) -> String { if !m.is_dir() { throw!(anyhow!("existing object is not a directory")); } - if (m.st_mode() & 0o0102) != 0 { + if (m.st_mode() & 0o01002) != 0 { throw!(anyhow!( "existing directory mode {:#o} is sticky or world-writeable. \ We use predictable pathnames so that would be a tmp race", @@ -85,7 +85,7 @@ fn prepare_tmpdir(opts: &Opts, current_exe: &str) -> String { .with_context(|| opts.tmp_dir.to_owned()) .context("prepare/create tmp-dir")?; - let leaf = current_exe.rsplitn(1, '/').next().unwrap(); + let leaf = current_exe.rsplitn(2, '/').next().unwrap(); let our_tmpdir = format!("{}/{}", &opts.tmp_dir, &leaf); (||{ match fs::remove_dir_all(&leaf) { -- 2.30.2