list_gnupg_ciphers: Pipe everything into /dev/null

Firstly the printed binary path is in the wrong place. Reading the text, one assumes Ciphers coming next.
Secondly it doesn't make sense to check there for a missing gnupg installation. Before calling list_gnupg_ciphers(), there is a direct call for gpg --version. If that fails the whole text is scrambled and no error reported

Dropping the output from which allows to remove the space from printing the ciphers. The text is correctly aligned now
This commit is contained in:
Narrat 2018-01-07 20:53:20 +01:00
parent 61fdab85be
commit e15c58dfd7

4
tomb
View File

@ -1360,7 +1360,7 @@ gen_key() {
# prints an array of ciphers available in gnupg (to encrypt keys) # prints an array of ciphers available in gnupg (to encrypt keys)
list_gnupg_ciphers() { list_gnupg_ciphers() {
# prints an error if GnuPG is not found # prints an error if GnuPG is not found
which gpg 2>/dev/null || _failure "gpg (GnuPG) is not found, Tomb cannot function without it." which gpg &>/dev/null || _failure "gpg (GnuPG) is not found, Tomb cannot function without it."
ciphers=(`gpg --version | awk ' ciphers=(`gpg --version | awk '
BEGIN { ciphers=0 } BEGIN { ciphers=0 }
@ -1368,7 +1368,7 @@ BEGIN { ciphers=0 }
/^Hash:/ { ciphers=0 } /^Hash:/ { ciphers=0 }
{ if(ciphers==0) { next } else { gsub(/,/,""); print; } } { if(ciphers==0) { next } else { gsub(/,/,""); print; } }
'`) '`)
print " ${ciphers}" print "${ciphers}"
return 1 return 1
} }