aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/password-store.sh
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 13:25:58 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2014-04-18 13:25:58 +0200
commite4d479a3fd695ced2cf7f1e9bdf6f8c3a4ad51ed (patch)
tree72439ff17d83392ba407a7af26720816993eb3cb /src/password-store.sh
parentRemove unneeded semicolon. (diff)
downloadpassword-store-e4d479a3fd695ced2cf7f1e9bdf6f8c3a4ad51ed.tar.xz
password-store-e4d479a3fd695ced2cf7f1e9bdf6f8c3a4ad51ed.zip
reencrypt: cleaner temp file declaration
Diffstat (limited to '')
-rwxr-xr-xsrc/password-store.sh8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/password-store.sh b/src/password-store.sh
index 3868600..eb98fad 100755
--- a/src/password-store.sh
+++ b/src/password-store.sh
@@ -88,17 +88,17 @@ reencrypt_path() {
local passfile
local passfile_dir
local passfile_display
- local fake_uniqueness_safety
+ local passfile_temp
local prev_gpg_recipients
local gpg_keys
local current_keys
find "$1" -iname '*.gpg' | while read -r passfile; do
- fake_uniqueness_safety="$RANDOM"
passfile_dir="${passfile%/*}"
passfile_dir="${passfile_dir#$PREFIX}"
passfile_dir="${passfile_dir#/}"
passfile_display="${passfile#$PREFIX/}"
passfile_display="${passfile_display%.gpg}"
+ passfile_temp="${passfile}.tmp.${RANDOM}.${RANDOM}.${RANDOM}.${RANDOM}.--"
set_gpg_recipients "$passfile_dir"
[[ $prev_gpg_recipients != "${GPG_RECIPIENTS[@]}" ]] &&
@@ -107,8 +107,8 @@ 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" || rm -f "$passfile.new.$fake_uniqueness_safety"
+ $GPG -d $GPG_OPTS "$passfile" | $GPG -e "${GPG_RECIPIENT_ARGS[@]}" -o "$passfile_temp" $GPG_OPTS &&
+ mv "$passfile_temp" "$passfile" || rm -f "$passfile_temp"
fi
prev_gpg_recipients="${GPG_RECIPIENTS[@]}"