From 75929df06ef93bef65f2911359341972726f6be4 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Fri, 18 Apr 2014 01:31:47 +0200 Subject: reencryption: remove temporary file on failure --- src/password-store.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/password-store.sh b/src/password-store.sh index 0828a32..598d1bf 100755 --- a/src/password-store.sh +++ b/src/password-store.sh @@ -108,7 +108,7 @@ reencrypt_path() { if [[ $gpg_keys != "$current_keys" ]]; then echo "$passfile_display: reencrypting to ${gpg_keys//$'\n'/ }" $GPG -d $GPG_OPTS "$passfile" | $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile.new.$fake_uniqueness_safety" $GPG_OPTS && - mv "$passfile.new.$fake_uniqueness_safety" "$passfile" + mv "$passfile.new.$fake_uniqueness_safety" "$passfile" || rm -f "$passfile.new.$fake_uniqueness_safety" fi prev_gpg_recipients="${GPG_RECIPIENTS[@]}" -- cgit v1.2.3