aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Daroussin <bapt@FreeBSD.org>2026-06-04 22:13:23 +0000
committerBaptiste Daroussin <bapt@FreeBSD.org>2026-06-05 06:01:44 +0000
commit5f9c8f142d1702f5810618e02534054d28d22fa5 (patch)
tree9b3e156510564f3f030679891366067893ce6870
parent4fd8a69ec6623da5ef33818be134efffebe37f75 (diff)
pw: fix const qualification in unquote()
The unquote() function took a const char * parameter but modified the string in-place (removing quote characters). Change the parameter to char * and update callers that passed const char * to cast explicitly.
-rw-r--r--usr.sbin/pw/pw_conf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/pw/pw_conf.c b/usr.sbin/pw/pw_conf.c
index e9042b15b321..21c4824ead93 100644
--- a/usr.sbin/pw/pw_conf.c
+++ b/usr.sbin/pw/pw_conf.c
@@ -156,22 +156,22 @@ static char const *kwds[] =
};
static char *
-unquote(char const * str)
+unquote(char * str)
{
if (str && (*str == '"' || *str == '\'')) {
char *p = strchr(str + 1, *str);
if (p != NULL)
*p = '\0';
- return (char *) (*++str ? str : NULL);
+ return (*++str ? str : NULL);
}
- return (char *) str;
+ return (str);
}
int
boolean_val(char const * str, int dflt)
{
- if ((str = unquote(str)) != NULL) {
+ if ((str = unquote((char *)str)) != NULL) {
int i;
for (i = 0; booltrue[i]; i++)
@@ -187,7 +187,7 @@ boolean_val(char const * str, int dflt)
int
passwd_val(char const * str, int dflt)
{
- if ((str = unquote(str)) != NULL) {
+ if ((str = unquote((char *)str)) != NULL) {
int i;
for (i = 0; booltrue[i]; i++)
@@ -228,7 +228,7 @@ newstr(char const * p)
{
char *q;
- if ((p = unquote(p)) == NULL)
+ if ((p = unquote((char *)p)) == NULL)
return (NULL);
if ((q = strdup(p)) == NULL)