]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
creds-tool: don't declare variable in switch body
authorLennart Poettering <lennart@poettering.net>
Mon, 15 Aug 2022 09:41:07 +0000 (11:41 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Mon, 15 Aug 2022 23:47:46 +0000 (08:47 +0900)
The lifetime of variables decalred in the main switch/case body is just
weird. Let's not rely on it, but just open a new {} block, like
everywhere else in similar cases.

src/creds/creds.c

index 59bb072115fe7a867275488bde53c3a7ca47804d..e9c7c96fc561065e58093d16afb02a64394a5b92 100644 (file)
@@ -832,13 +832,14 @@ static int parse_argv(int argc, char *argv[]) {
                         arg_tpm2_device = streq(optarg, "auto") ? NULL : optarg;
                         break;
 
-                case ARG_TPM2_PCRS:
+                case ARG_TPM2_PCRS: {
+                        uint32_t mask;
+
                         if (isempty(optarg)) {
                                 arg_tpm2_pcr_mask = 0;
                                 break;
                         }
 
-                        uint32_t mask;
                         r = tpm2_parse_pcrs(optarg, &mask);
                         if (r < 0)
                                 return r;
@@ -849,6 +850,7 @@ static int parse_argv(int argc, char *argv[]) {
                                 arg_tpm2_pcr_mask |= mask;
 
                         break;
+                }
 
                 case ARG_NAME:
                         if (isempty(optarg)) {