autofs-5.1.9 - fix a couple of compile warnings From: Ian Kent gcc started reporting some inconsistent const variable usages, fix as required. Signed-off-by: Ian Kent --- CHANGELOG | 1 + daemon/automount.c | 2 +- lib/parse_subs.c | 6 +++--- modules/mount_autofs.c | 3 ++- modules/replicated.c | 4 ++-- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index c19d7c85f..ef095c7e0 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -105,6 +105,7 @@ - add ability to disable negative cache. - add cifs mount module. - refactor mount_nfs.c:mount_mount(). +- fix a couple of compile warnings. 02/11/2023 autofs-5.1.9 - fix kernel mount status notification. diff --git a/daemon/automount.c b/daemon/automount.c index 83c348be4..360ff20bf 100644 --- a/daemon/automount.c +++ b/daemon/automount.c @@ -502,7 +502,7 @@ static int umount_subtree_mounts(struct autofs_point *ap, const char *path, unsi me = lookup_source_mapent(ap, path, LKP_DISTINCT); if (!me) { - char *ind_key; + const char *ind_key; ind_key = strrchr(path, '/'); if (ind_key) diff --git a/lib/parse_subs.c b/lib/parse_subs.c index 8f071d3a2..989b67e28 100644 --- a/lib/parse_subs.c +++ b/lib/parse_subs.c @@ -829,8 +829,8 @@ int span_space(const char *str, unsigned int maxlen) char *sanitize_path(const char *path, int origlen, unsigned int type, unsigned int logopt) { - char *slash, *cp, *s_path; - const char *scp; + char *cp, *s_path; + const char *slash, *scp; int len = origlen; unsigned int seen_slash = 0, quote = 0, dquote = 0; @@ -977,7 +977,7 @@ char *merge_options(const char *opt1, const char *opt2) resultlen = 0; tok = strtok_r(str, ",", &ptr); while (tok) { - const char *this = (const char *) tok; + char *this = tok; char *eq = strchr(this, '='); size_t this_len = strlen(this); diff --git a/modules/mount_autofs.c b/modules/mount_autofs.c index b39d06cee..56998166f 100644 --- a/modules/mount_autofs.c +++ b/modules/mount_autofs.c @@ -141,8 +141,9 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, else if (_strncmp("hosts", cp, 5) == 0) hosts = 1; else if (_strncmp("timeout=", cp, 8) == 0) { - char *val = strchr(cp, '='); + const char *val = strchr(cp, '='); unsigned tout; + if (val) { int ret = sscanf(cp, "timeout=%u", &tout); if (ret) diff --git a/modules/replicated.c b/modules/replicated.c index 0c715ba73..1a3bf6c38 100644 --- a/modules/replicated.c +++ b/modules/replicated.c @@ -1111,9 +1111,9 @@ static int add_local_path(struct host **hosts, const char *path) return 1; } -static char *seek_delim(const char *s) +static char *seek_delim(char *s) { - const char *p = s; + char *p = s; char *delim; delim = strpbrk(p, "(, \t:");