From f20cbd26f4b4ff268f16ce16bcaf13e4c654de7a Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Tue, 1 Jun 2021 21:45:37 +0100 Subject: [PATCH] sshkeys: Allow the creation of a fresh auth keys file Signed-off-by: Ian Jackson --- src/sshkeys.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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")?; -- 2.30.2