From: Karel Zak Date: Thu, 27 Nov 2025 15:28:41 +0000 (+0100) Subject: libblkid: fix const qualifier warning in blkid_parse_tag_string X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c45442ef125270d0ab2cb539747ccaf737d60d37;p=thirdparty%2Futil-linux.git libblkid: fix const qualifier warning in blkid_parse_tag_string Fix const qualifier discarded warning in blkid_parse_tag_string(). This warning is reported by gcc 15 which defaults to the C23 standard. The strchr() function returns a pointer into a const string, so introduce a separate 'eq' variable to hold this const pointer for finding the '=' separator. Also move the 'cp' variable declaration into the block where it's actually used for quote handling. Signed-off-by: Karel Zak --- diff --git a/libblkid/src/tag.c b/libblkid/src/tag.c index 178336505..f195c0625 100644 --- a/libblkid/src/tag.c +++ b/libblkid/src/tag.c @@ -202,21 +202,23 @@ errout: */ int blkid_parse_tag_string(const char *token, char **ret_type, char **ret_val) { - char *name, *value, *cp; + char *name, *value; + const char *eq; DBG(TAG, ul_debug("trying to parse '%s' as a tag", token)); - if (!token || !(cp = strchr(token, '='))) + if (!token || !(eq = strchr(token, '='))) return -1; name = strdup(token); if (!name) return -1; - value = name + (cp - token); + value = name + (eq - token); *value++ = '\0'; if (*value == '"' || *value == '\'') { char c = *value++; - if (!(cp = strrchr(value, c))) + char *cp = strrchr(value, c); + if (!cp) goto errout; /* missing closing quote */ *cp = '\0'; }