aboutsummaryrefslogtreecommitdiffstats
path: root/src/store.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/store.rs')
-rw-r--r--src/store.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/store.rs b/src/store.rs
index 98c5481..04d7414 100644
--- a/src/store.rs
+++ b/src/store.rs
@@ -182,7 +182,8 @@ impl PasteStore {
/// corruption if the process is killed mid-write.
fn atomic_write(path: &Path, chunks: &[&[u8]]) -> std::io::Result<()> {
let parent = path.parent().unwrap_or(Path::new("."));
- let tmp = parent.join(format!(".tmp.{}", std::process::id()));
+ let name = path.file_name().and_then(|n| n.to_str()).unwrap_or("tmp");
+ let tmp = parent.join(format!(".tmp.{}.{}", std::process::id(), name));
let mut f = fs::File::create(&tmp)?;
for chunk in chunks {
f.write_all(chunk)?;