From: Lennart Poettering Date: Mon, 15 Aug 2022 09:41:07 +0000 (+0200) Subject: creds-tool: don't declare variable in switch body X-Git-Tag: v252-rc1~442 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=108bb8d065eaae907d33d41b6a502f38e2f127ba;p=thirdparty%2Fsystemd.git creds-tool: don't declare variable in switch body 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. --- diff --git a/src/creds/creds.c b/src/creds/creds.c index 59bb072115f..e9c7c96fc56 100644 --- a/src/creds/creds.c +++ b/src/creds/creds.c @@ -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)) {