diff options
author | des <des@FreeBSD.org> | 2008-11-04 13:49:53 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2008-11-04 13:49:53 +0000 |
commit | d1723ee052a3fdfc4b0ce003935ffa4913643a54 (patch) | |
tree | 7b24cc187be9dc70c6994a3381bdedcff4dde21c /lib/libutil/login_class.c | |
parent | 5ff0dc16bf8577b67b34e18769566a6bc74ba800 (diff) | |
download | FreeBSD-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.c | 11 |
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) |