summaryrefslogtreecommitdiff
path: root/lib/keyringer/actions/edit
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-02-20 11:10:22 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-02-20 11:10:22 -0300
commit4b4aff2edac956224849d36fe83f826303d25efd (patch)
treeed8446593f57b091730a40ea93c626548c7328dc /lib/keyringer/actions/edit
parent5f1590e0722ee5ee9fed2ccc43adfb88f00218fd (diff)
parent013726598e074399344c0bf435e057bc8049959a (diff)
downloadkeyringer-4b4aff2edac956224849d36fe83f826303d25efd.tar.gz
keyringer-4b4aff2edac956224849d36fe83f826303d25efd.tar.bz2
Imported Upstream version 0.3upstream_keyringer_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