Fix C std23 related warnings with new glibc.

C standard library functions now preserves qualifiers passed
to some functions. In case of strchr() if the passed argument is
const qualified also the returned value is const qualified. Similarly
if the passed argument is not const qualified neither is the return
value.

This patch makes libcryptsetup compliant with the change and should
be backward compatible with older std libraries.

Thanks Vojta Trefny for heads-up.
This commit is contained in:
Ondrej Kozina
2025-12-02 11:07:04 +01:00
parent f1ba606c28
commit a07c8a556c
5 changed files with 12 additions and 8 deletions

View File

@@ -77,7 +77,7 @@ static int crypt_sector_iv_init(struct crypt_sector_iv *ctx,
ctx->type = IV_PLAIN;
} else if (!strncasecmp(iv_name, "essiv:", 6)) {
struct crypt_hash *h = NULL;
char *hash_name = strchr(iv_name, ':');
const char *hash_name = strchr(iv_name, ':');
int hash_size;
char tmp[256];