diff options
Diffstat (limited to 'src/usr.bin/openssl/certhash.c')
| -rw-r--r-- | src/usr.bin/openssl/certhash.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/usr.bin/openssl/certhash.c b/src/usr.bin/openssl/certhash.c index 785f1216ad..5ee29b8d01 100644 --- a/src/usr.bin/openssl/certhash.c +++ b/src/usr.bin/openssl/certhash.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: certhash.c,v 1.20 2022/11/11 17:07:38 joshua Exp $ */ | 1 | /* $OpenBSD: certhash.c,v 1.21 2023/03/06 14:32:05 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2014, 2015 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -36,20 +36,20 @@ | |||
| 36 | static struct { | 36 | static struct { |
| 37 | int dryrun; | 37 | int dryrun; |
| 38 | int verbose; | 38 | int verbose; |
| 39 | } certhash_config; | 39 | } cfg; |
| 40 | 40 | ||
| 41 | static const struct option certhash_options[] = { | 41 | static const struct option certhash_options[] = { |
| 42 | { | 42 | { |
| 43 | .name = "n", | 43 | .name = "n", |
| 44 | .desc = "Perform a dry-run - do not make any changes", | 44 | .desc = "Perform a dry-run - do not make any changes", |
| 45 | .type = OPTION_FLAG, | 45 | .type = OPTION_FLAG, |
| 46 | .opt.flag = &certhash_config.dryrun, | 46 | .opt.flag = &cfg.dryrun, |
| 47 | }, | 47 | }, |
| 48 | { | 48 | { |
| 49 | .name = "v", | 49 | .name = "v", |
| 50 | .desc = "Verbose", | 50 | .desc = "Verbose", |
| 51 | .type = OPTION_FLAG, | 51 | .type = OPTION_FLAG, |
| 52 | .opt.flag = &certhash_config.verbose, | 52 | .opt.flag = &cfg.verbose, |
| 53 | }, | 53 | }, |
| 54 | { NULL }, | 54 | { NULL }, |
| 55 | }; | 55 | }; |
| @@ -569,7 +569,7 @@ certhash_directory(const char *path) | |||
| 569 | goto err; | 569 | goto err; |
| 570 | } | 570 | } |
| 571 | 571 | ||
| 572 | if (certhash_config.verbose) | 572 | if (cfg.verbose) |
| 573 | fprintf(stdout, "scanning directory %s\n", path); | 573 | fprintf(stdout, "scanning directory %s\n", path); |
| 574 | 574 | ||
| 575 | /* Create lists of existing hash links, certs and CRLs. */ | 575 | /* Create lists of existing hash links, certs and CRLs. */ |
| @@ -594,11 +594,11 @@ certhash_directory(const char *path) | |||
| 594 | if (link->exists == 0 || | 594 | if (link->exists == 0 || |
| 595 | (link->reference != NULL && link->changed == 0)) | 595 | (link->reference != NULL && link->changed == 0)) |
| 596 | continue; | 596 | continue; |
| 597 | if (certhash_config.verbose) | 597 | if (cfg.verbose) |
| 598 | fprintf(stdout, "%s link %s -> %s\n", | 598 | fprintf(stdout, "%s link %s -> %s\n", |
| 599 | (certhash_config.dryrun ? "would remove" : | 599 | (cfg.dryrun ? "would remove" : |
| 600 | "removing"), link->filename, link->target); | 600 | "removing"), link->filename, link->target); |
| 601 | if (certhash_config.dryrun) | 601 | if (cfg.dryrun) |
| 602 | continue; | 602 | continue; |
| 603 | if (unlink(link->filename) == -1) { | 603 | if (unlink(link->filename) == -1) { |
| 604 | fprintf(stderr, "failed to remove link %s\n", | 604 | fprintf(stderr, "failed to remove link %s\n", |
| @@ -611,12 +611,12 @@ certhash_directory(const char *path) | |||
| 611 | for (link = links; link != NULL; link = link->next) { | 611 | for (link = links; link != NULL; link = link->next) { |
| 612 | if (link->exists == 1 && link->changed == 0) | 612 | if (link->exists == 1 && link->changed == 0) |
| 613 | continue; | 613 | continue; |
| 614 | if (certhash_config.verbose) | 614 | if (cfg.verbose) |
| 615 | fprintf(stdout, "%s link %s -> %s\n", | 615 | fprintf(stdout, "%s link %s -> %s\n", |
| 616 | (certhash_config.dryrun ? "would create" : | 616 | (cfg.dryrun ? "would create" : |
| 617 | "creating"), link->filename, | 617 | "creating"), link->filename, |
| 618 | link->reference->filename); | 618 | link->reference->filename); |
| 619 | if (certhash_config.dryrun) | 619 | if (cfg.dryrun) |
| 620 | continue; | 620 | continue; |
| 621 | if (symlink(link->reference->filename, link->filename) == -1) { | 621 | if (symlink(link->reference->filename, link->filename) == -1) { |
| 622 | fprintf(stderr, "failed to create link %s -> %s\n", | 622 | fprintf(stderr, "failed to create link %s -> %s\n", |
| @@ -658,7 +658,7 @@ certhash_main(int argc, char **argv) | |||
| 658 | exit(1); | 658 | exit(1); |
| 659 | } | 659 | } |
| 660 | 660 | ||
| 661 | memset(&certhash_config, 0, sizeof(certhash_config)); | 661 | memset(&cfg, 0, sizeof(cfg)); |
| 662 | 662 | ||
| 663 | if (options_parse(argc, argv, certhash_options, NULL, &argsused) != 0) { | 663 | if (options_parse(argc, argv, certhash_options, NULL, &argsused) != 0) { |
| 664 | certhash_usage(); | 664 | certhash_usage(); |
