From: Ian Jackson Date: Tue, 22 Dec 2020 22:33:22 +0000 (+0000) Subject: wip tmpdir setup X-Git-Tag: otter-0.2.0~169 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=4e6724212014d171f5096e0f2e72f0771e67dc23;p=otter.git wip tmpdir setup Signed-off-by: Ian Jackson --- 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) {