From: Frantisek Sumsal Date: Sat, 21 May 2022 15:30:51 +0000 (+0200) Subject: cryptsetup: fix build with -Db_ndebug=true X-Git-Tag: v252-rc1~944^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dfe7cfe4fbd4d2de99a8e97919dd5f7cdef1a1c5;p=thirdparty%2Fsystemd.git cryptsetup: fix build with -Db_ndebug=true ``` ... ../src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c:33:13: error: variable 'r' set but not used [-Werror,-Wunused-but-set-variable] int r; ^ 1 error generated. ... ../src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c:34:13: error: variable 'r' set but not used [-Werror,-Wunused-but-set-variable] int r; ^ 1 error generated. ninja: build stopped: subcommand failed. + fatal ''\''meson compile'\'' failed with -Db_ndebug=true' ``` --- diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c index c1408a84408..0db0f562e51 100644 --- a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c @@ -39,7 +39,8 @@ _public_ int cryptsetup_token_open_pin( /* This must not fail at this moment (internal error) */ r = crypt_token_json_get(cd, token, &json); - assert(token == r); + /* Use assert_se() here to avoid emitting warning with -DNDEBUG */ + assert_se(token == r); assert(json); if (pin && memchr(pin, 0, pin_size - 1)) diff --git a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c index 3b3fe2c1e02..c3e7fbd0615 100644 --- a/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c +++ b/src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c @@ -38,7 +38,8 @@ _public_ int cryptsetup_token_open_pin( /* This must not fail at this moment (internal error) */ r = crypt_token_json_get(cd, token, &json); - assert(token == r); + /* Use assert_se() here to avoid emitting warning with -DNDEBUG */ + assert_se(token == r); assert(json); return acquire_luks2_key(cd, json, usrptr, pin, pin_size, password, password_len);