git: 5f9c8f142d17 - main - pw: fix const qualification in unquote()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 05 Jun 2026 06:02:37 UTC
The branch main has been updated by bapt:
URL: https://cgit.FreeBSD.org/src/commit/?id=5f9c8f142d1702f5810618e02534054d28d22fa5
commit 5f9c8f142d1702f5810618e02534054d28d22fa5
Author: Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2026-06-04 22:13:23 +0000
Commit: Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2026-06-05 06:01:44 +0000
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.
---
usr.sbin/pw/pw_conf.c | 12 ++++++------
1 file 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)