From: Ian Jackson Date: Tue, 1 Jun 2021 20:45:37 +0000 (+0100) Subject: sshkeys: Allow the creation of a fresh auth keys file X-Git-Tag: otter-0.7.0~127 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=f20cbd26f4b4ff268f16ce16bcaf13e4c654de7a;p=otter.git sshkeys: Allow the creation of a fresh auth keys file Signed-off-by: Ian Jackson --- diff --git a/src/sshkeys.rs b/src/sshkeys.rs index 7ddacc8d..c1e07314 100644 --- a/src/sshkeys.rs +++ b/src/sshkeys.rs @@ -468,7 +468,10 @@ impl Global { let tmp = format!("{}.tmp", &path); (||{ - let f = File::open(path).context("open")?; + let f = match File::open(path) { + Err(e) if e.kind() == ErrorKind::NotFound => return Ok(()), + x => x, + }.context("open")?; let l = BufReader::new(f).lines().next() .ok_or_else(|| anyhow!("no first line!"))? .context("read first line")?;