From 11d1f3776b2ae2a090c95095200c1c8f0bb01a8f Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Wed, 25 Sep 2024 16:26:17 +0100 Subject: [PATCH] Don't exit(1) after printing PGP key fingerprints. That's not a failure outcome. The user asked for some information; we printed it; nothing went wrong. Mission successful, so exit(0)! I noticed this because it was sitting right next to some of the usage() calls modified in the previous commit. Those also had the misfeature of exiting with failure after successfully printing the help, possibly due to confusion arising from the way that usage() was _sometimes_ printed on error as well. But pgp_fingerprints() has no such excuse. That one's just silly. --- pscp.c | 2 +- psftp.c | 2 +- unix/main-gtk-simple.c | 2 +- unix/plink.c | 2 +- windows/pageant.c | 2 +- windows/plink.c | 2 +- windows/putty.c | 2 +- windows/puttygen.c | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pscp.c b/pscp.c index 192bc138..08e37ceb 100644 --- a/pscp.c +++ b/pscp.c @@ -2299,7 +2299,7 @@ int psftp_main(CmdlineArgList *arglist) verbose = true; } else if (strcmp(argstr, "-pgpfp") == 0) { pgp_fingerprints(); - return 1; + return 0; } else if (strcmp(argstr, "-r") == 0) { recursive = true; } else if (strcmp(argstr, "-p") == 0) { diff --git a/psftp.c b/psftp.c index 78d6d139..5afd5e54 100644 --- a/psftp.c +++ b/psftp.c @@ -2839,7 +2839,7 @@ int psftp_main(CmdlineArgList *arglist) cleanup_exit(0); } else if (strcmp(argstr, "-pgpfp") == 0) { pgp_fingerprints(); - return 1; + return 0; } else if (strcmp(argstr, "-V") == 0 || strcmp(argstr, "--version") == 0) { version(); diff --git a/unix/main-gtk-simple.c b/unix/main-gtk-simple.c index 76487772..9b3c225e 100644 --- a/unix/main-gtk-simple.c +++ b/unix/main-gtk-simple.c @@ -529,7 +529,7 @@ bool do_cmdline(int argc, char **argv, bool do_everything, Conf *conf) } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); - exit(1); + exit(0); } else if (has_ca_config_box && (!strcmp(p, "-host-ca") || !strcmp(p, "--host-ca") || diff --git a/unix/plink.c b/unix/plink.c index f2b6b072..36bf29d1 100644 --- a/unix/plink.c +++ b/unix/plink.c @@ -747,7 +747,7 @@ int main(int argc, char **argv) exit(0); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); - exit(1); + exit(0); } else if (!strcmp(p, "-o")) { if (argc <= 1) { fprintf(stderr, diff --git a/windows/pageant.c b/windows/pageant.c index f30d9cdc..eb858a3b 100644 --- a/windows/pageant.c +++ b/windows/pageant.c @@ -1616,7 +1616,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) clkey->add_encrypted = add_keys_encrypted; } else if (match_opt("-pgpfp")) { pgp_fingerprints_msgbox(NULL); - return 1; + return 0; } else if (match_opt("-restrict-acl", "-restrict_acl", "-restrictacl")) { restrict_process_acl(); diff --git a/windows/plink.c b/windows/plink.c index 95025281..46773815 100644 --- a/windows/plink.c +++ b/windows/plink.c @@ -352,7 +352,7 @@ int main(int argc, char **argv) exit(0); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints(); - exit(1); + exit(0); } else if (!strcmp(p, "-shareexists")) { just_test_share_exists = true; } else if (!strcmp(p, "-sanitise-stdout") || diff --git a/windows/putty.c b/windows/putty.c index eb1386e8..3a320e19 100644 --- a/windows/putty.c +++ b/windows/putty.c @@ -87,7 +87,7 @@ void gui_term_process_cmdline(Conf *conf, char *cmdline) exit(0); } else if (!strcmp(p, "-pgpfp")) { pgp_fingerprints_msgbox(NULL); - exit(1); + exit(0); } else if (has_ca_config_box && (!strcmp(p, "-host-ca") || !strcmp(p, "--host-ca") || !strcmp(p, "-host_ca") || !strcmp(p, "--host_ca"))) { diff --git a/windows/puttygen.c b/windows/puttygen.c index 643e1113..0e4f9a78 100644 --- a/windows/puttygen.c +++ b/windows/puttygen.c @@ -2436,7 +2436,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) } } else if (match_opt("-pgpfp")) { pgp_fingerprints_msgbox(NULL); - return 1; + return 0; } else if (match_opt("-restrict-acl", "-restrict_acl", "-restrictacl")) { restrict_process_acl();