summaryrefslogtreecommitdiffstats
path: root/lib/libutil/login_class.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2008-11-04 13:49:53 +0000
committerdes <des@FreeBSD.org>2008-11-04 13:49:53 +0000
commitd1723ee052a3fdfc4b0ce003935ffa4913643a54 (patch)
tree7b24cc187be9dc70c6994a3381bdedcff4dde21c /lib/libutil/login_class.c
parent5ff0dc16bf8577b67b34e18769566a6bc74ba800 (diff)
downloadFreeBSD-src-d1723ee052a3fdfc4b0ce003935ffa4913643a54.zip
FreeBSD-src-d1723ee052a3fdfc4b0ce003935ffa4913643a54.tar.gz
Avoid assigning a const char * to a char *.
MFC after: 3 weeks
Diffstat (limited to 'lib/libutil/login_class.c')
-rw-r--r--lib/libutil/login_class.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/libutil/login_class.c b/lib/libutil/login_class.c
index 94cb3aa..5074519 100644
--- a/lib/libutil/login_class.c
+++ b/lib/libutil/login_class.c
@@ -142,14 +142,13 @@ substvar(const char * var, const struct passwd * pwd, int hlen, int pch, int nle
int tildes = 0;
int dollas = 0;
char *p;
+ const char *q;
if (pwd != NULL) {
- /* Count the number of ~'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '~')) != NULL; p++)
- ++tildes;
- /* Count the number of $'s in var to substitute */
- for (p = (char *)var; (p = strchr(p, '$')) != NULL; p++)
- ++dollas;
+ for (q = var; *q != '\0'; ++q) {
+ tildes += (*q == '~');
+ dollas += (*q == '$');
+ }
}
np = malloc(strlen(var) + (dollas * nlen)
OpenPOWER on IntegriCloud