chiark
/
gitweb
/
~ianmdlvl
/
otter.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
efc4cc5
)
sshkeys: Allow the creation of a fresh auth keys file
author
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 1 Jun 2021 20:45:37 +0000
(21:45 +0100)
committer
Ian Jackson
<ijackson@chiark.greenend.org.uk>
Tue, 1 Jun 2021 20:57:43 +0000
(21:57 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/sshkeys.rs
patch
|
blob
|
history
diff --git
a/src/sshkeys.rs
b/src/sshkeys.rs
index 7ddacc8d3d8c20e4ef38355dc6e5c75d019a2bd0..c1e07314b0b4f6ef09429d59d66b31a1df0e5e91 100644
(file)
--- 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")?;