add trap to remove temp dir in list_primary_fingerprints function
[monkeysphere.git] / src / share / common
index de97ef76085a7fe52b33391d32562329f395fc99..914fffa5e9536d69365deab301aba75899812b71 100644 (file)
@@ -762,7 +762,7 @@ process_user_id() {
 }
 
 # output all valid keys for specified user ID literal
-keys_from_userid() {
+keys_for_userid() {
     local userID
     local noKey=
     local nKeys
@@ -1177,9 +1177,11 @@ process_authorized_user_ids() {
 # fingerprints, one per line:
 list_primary_fingerprints() {
     local fake=$(msmktempdir)
+    trap "rm -rf $fake" EXIT
     GNUPGHOME="$fake" gpg --no-tty --quiet --import
     GNUPGHOME="$fake" gpg --with-colons --fingerprint --list-keys | \
        awk -F: '/^fpr:/{ print $10 }'
+    trap - EXIT
     rm -rf "$fake"
 }