diff options
author | NIIBE Yutaka <[email protected]> | 2016-06-28 06:56:48 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2016-06-28 07:10:14 +0000 |
commit | 39e32d375ef72874848f138d941d6d17f5aff85c (patch) | |
tree | 5b7c08d658d073e9963c48ea76a9863e0ef3776d | |
parent | g10: Fix another race condition for trustdb access. (diff) | |
download | gnupg-39e32d375ef72874848f138d941d6d17f5aff85c.tar.gz gnupg-39e32d375ef72874848f138d941d6d17f5aff85c.zip |
g10: Fix --list-packets.
* g10/gpg.c (main): Call set_packet_list_mode after assignment of
opt.list_packets.
* g10/mainproc.c (do_proc_packets): Don't stop processing with
--list-packets as the comment says.
* g10/options.h (list_packets): Fix the comment.
* g10/parse-packet.c: Fix the condition for opt.list_packets.
--
(backport from 2.0 commit 4f336ed780cc2783395f3ff2b12b3ebb8e097f7b
which is backport of master
commit 52f65281f9743c42a48bf5a3354c9ab0ecdb681a)
Debian-bug-id: 828109
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r-- | g10/gpg.c | 3 | ||||
-rw-r--r-- | g10/mainproc.c | 2 | ||||
-rw-r--r-- | g10/options.h | 2 | ||||
-rw-r--r-- | g10/parse-packet.c | 2 |
4 files changed, 4 insertions, 5 deletions
@@ -3953,7 +3953,6 @@ main (int argc, char **argv ) break; case aListPackets: - opt.list_packets=2; default: if( argc > 1 ) wrong_args(_("[filename]")); @@ -3980,8 +3979,8 @@ main (int argc, char **argv ) } } if( cmd == aListPackets ) { - set_packet_list_mode(1); opt.list_packets=1; + set_packet_list_mode(1); } rc = proc_packets(NULL, a ); if( rc ) diff --git a/g10/mainproc.c b/g10/mainproc.c index a773fde19..33a654b34 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1264,7 +1264,7 @@ do_proc_packets( CTX c, IOBUF a ) free_packet(pkt); /* stop processing when an invalid packet has been encountered * but don't do so when we are doing a --list-packets. */ - if( rc == G10ERR_INVALID_PACKET && opt.list_packets != 2 ) + if( rc == G10ERR_INVALID_PACKET && opt.list_packets == 0 ) break; continue; } diff --git a/g10/options.h b/g10/options.h index 5aa3a048d..0ac6e7755 100644 --- a/g10/options.h +++ b/g10/options.h @@ -61,7 +61,7 @@ struct int fingerprint; /* list fingerprints */ int list_sigs; /* list signatures */ int no_armor; - int list_packets; /* list-packets mode: 1=normal, 2=invoked by command*/ + int list_packets; /* Option --list-packets active. */ int def_cipher_algo; int force_v3_sigs; int force_v4_certs; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index beee77ed0..b5d19b134 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -134,7 +134,7 @@ set_packet_list_mode( int mode ) whether using log_stream() would be better. Perhaps we should enable the list mdoe only with a special option. */ if (!listfp) - listfp = opt.list_packets == 2 ? stdout : stderr; + listfp = opt.list_packets ? stdout : stderr; return old; } |