From: Silvio Rhatto Date: Wed, 12 Feb 2014 14:13:27 +0000 (-0200) Subject: Proper error handling at edit action X-Git-Tag: 0.3~8 X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=0471007d92b837d8d5df2c6d3a80fffd1048c3a4;p=keyringer.git Proper error handling at edit action --- 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