summaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/edit
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-20 11:10:23 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-02-20 11:10:23 -0300
commitefaacc68a2539cf57fdba395598f708d366cabc9 (patch)
tree3235b55b52df00c14ab99be9eb2255e3110b860b /lib/keyringer/actions/edit
parent10ec7a4f87812576f6bf3543282b49030ba77e64 (diff)
parent4b4aff2edac956224849d36fe83f826303d25efd (diff)
downloadkeyringer-efaacc68a2539cf57fdba395598f708d366cabc9.tar.gz
keyringer-efaacc68a2539cf57fdba395598f708d366cabc9.tar.bz2
Merge tag 'upstream_keyringer_0.3' into debian
Upstream version 0.3
Diffstat (limited to 'lib/keyringer/actions/edit')
-rwxr-xr-xlib/keyringer/actions/edit14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/keyringer/actions/edit b/lib/keyringer/actions/edit
index 9a3e488..03ccdab 100755
--- a/lib/keyringer/actions/edit
+++ b/lib/keyringer/actions/edit
@@ -24,6 +24,7 @@ keyringer_set_tmpfile $BASENAME.$EXTENSION
# Decrypt the information to the file
$GPG --yes -o "$TMPWORK" --use-agent -d "$KEYDIR/$FILE"
+# Action check
if [ "$BASENAME" == "edit" ]; then
APP="$EDITOR"
elif [ "$BASENAME" == "open" ]; then
@@ -43,5 +44,18 @@ $APP "$TMPWORK"
# Encrypt again
$GPG --yes -o "$KEYDIR/$FILE" --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") "$TMPWORK"
+# Check exit status
+errcrypt="$?"
+
# Remove temp file
keyringer_unset_tmpfile "$TMPWORK"
+
+# Check exit status again
+errwipe="$?"
+
+# Error handling must be done after temp file removal
+if [ "$errcrypt" != "0" ]; then
+ exit "$errcrypt"
+elif [ "$errwipe" != "0" ]; then
+ exit $errwipe
+fi