From d72349bde058352c6f6350119e47e29623cd5e82 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 20 May 2009 10:25:58 +0000 Subject: [PATCH] Fix bug#1044. --- g10/ChangeLog | 5 +++++ g10/gpg.c | 20 ++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/g10/ChangeLog b/g10/ChangeLog index 2c07f1bc2..655734bfa 100644 --- a/g10/ChangeLog +++ b/g10/ChangeLog @@ -1,3 +1,8 @@ +2009-05-20 Werner Koch + + * gpg.c (main): Fix --fingerprint/--with-fingerprint command + detection. Fixes bug#1044. + 2009-05-11 Werner Koch * apdu.c (send_le): Replace log_error by log_info. Fixes bug#1043. diff --git a/g10/gpg.c b/g10/gpg.c index 730899ccc..81a737002 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -1859,7 +1859,7 @@ main (int argc, char **argv ) int eyes_only=0; int multifile=0; int pwfd = -1; - int with_fpr = 0; /* make an option out of --fingerprint */ + int fpr_maybe_cmd = 0; /* --fingerprint maybe a command. */ int any_explicit_recipient = 0; int require_secmem=0,got_secmem=0; #ifdef USE_SHM_COPROCESSING @@ -2228,8 +2228,13 @@ main (int argc, char **argv ) case oWithFingerprint: opt.with_fingerprint = 1; - with_fpr=1; /*fall thru*/ - case oFingerprint: opt.fingerprint++; break; + opt.fingerprint++; + break; + case oFingerprint: + opt.fingerprint++; + fpr_maybe_cmd = 1; + break; + case oSecretKeyring: append_to_strlist( &sec_nrings, pargs.r.ret_str); break; @@ -3268,9 +3273,12 @@ main (int argc, char **argv ) xfree(p); } - if( !cmd && opt.fingerprint && !with_fpr ) { - set_cmd( &cmd, aListKeys); - } + /* If there is no command but the --fingerprint is given, default + to the --list-keys command. */ + if (!cmd && fpr_maybe_cmd) + { + set_cmd (&cmd, aListKeys); + } if( cmd == aKMode || cmd == aKModeC ) { /* kludge to be compatible to pgp */ if( cmd == aKModeC ) {