]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
cryptsetup: fix build with -Db_ndebug=true
authorFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 21 May 2022 15:30:51 +0000 (17:30 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Sat, 21 May 2022 21:27:24 +0000 (23:27 +0200)
```
 ...
 ../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'
```

src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-fido2.c
src/cryptsetup/cryptsetup-tokens/cryptsetup-token-systemd-pkcs11.c

index c1408a84408a4cdd4b009298e033834bc684dce4..0db0f562e518093425eebe7c25bbaa589967b88c 100644 (file)
@@ -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))
index 3b3fe2c1e02d66a2fd72d9c748016893ba7489eb..c3e7fbd0615536aeca200efeebfe91833c877cd4 100644 (file)
@@ -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);