zkey: Fix 'assignment discards 'const' qualifier' warnings

Fix compile warnings like

   warning: assignment discards 'const' qualifier from pointer target type
                                                   [-Wdiscarded-qualifiers]

by declaring the variables as const or cast appropriately.

Reviewed-by: Finn Callies <fcallies@linux.ibm.com>
Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2026-06-08 09:18:39 +02:00
committed by Jan Höppner
parent 679ab77b96
commit 27f20495a7
2 changed files with 7 additions and 7 deletions

View File

@@ -1423,7 +1423,7 @@ static int _keystore_volume_check(const char *volume, bool remove, bool set,
}
info->volume = util_strdup(volume);
ch = strchr(info->volume, ':');
ch = (char *)strchr(info->volume, ':');
if (ch == NULL || strlen(ch + 1) == 0) {
warnx("Volume specification must contain a dm-crypt mapping "
"name separated by a colon");

View File

@@ -540,11 +540,11 @@ unsigned int str_list_count(const char *str_list)
* or NULL if the string was not found
*
*/
static char *str_list_find(const char *str_list, const char *str)
static const char *str_list_find(const char *str_list, const char *str)
{
char *before;
char *after;
char *ch;
const char *before;
const char *after;
const char *ch;
ch = strstr(str_list, str);
if (ch == NULL)
@@ -608,9 +608,9 @@ char *str_list_add(const char *str_list, const char *str)
*/
char *str_list_remove(const char *str_list, const char *str)
{
char *after;
const char *after;
const char *ch;
char *ret;
char *ch;
util_assert(str_list != NULL, "Internal error: str_list is NULL");
util_assert(str != NULL, "Internal error: str is NULL");