]> gitweb.fluxo.info Git - keyringer.git/commitdiff
Proper error handling at edit action
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 12 Feb 2014 14:13:27 +0000 (12:13 -0200)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 12 Feb 2014 14:13:27 +0000 (12:13 -0200)
lib/keyringer/actions/edit

index 5f31aa0c696154e4ede75adb9f6897564ee0787b..03ccdab0315d1d8e708b6a84e4a616a8efd5d8e7 100755 (executable)
@@ -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