summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-12 12:13:27 -0200
committerSilvio Rhatto <rhatto@riseup.net>2014-02-12 12:13:27 -0200
commit0471007d92b837d8d5df2c6d3a80fffd1048c3a4 (patch)
tree548b3a75f93609dc85ae2074b8ef506e78896c2c /lib
parent05c979445a142de0b9a66995728d984ab2247856 (diff)
downloadkeyringer-0471007d92b837d8d5df2c6d3a80fffd1048c3a4.tar.gz
keyringer-0471007d92b837d8d5df2c6d3a80fffd1048c3a4.tar.bz2
Proper error handling at edit action
Diffstat (limited to 'lib')
-rwxr-xr-xlib/keyringer/actions/edit13
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/keyringer/actions/edit b/lib/keyringer/actions/edit
index 5f31aa0..03ccdab 100755
--- a/lib/keyringer/actions/edit
+++ b/lib/keyringer/actions/edit
@@ -44,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