diff options
-rw-r--r-- | lib/util/parmlist.c | 7 | ||||
-rw-r--r-- | lib/util/tevent_debug.c | 3 | ||||
-rw-r--r-- | lib/util/util_runcmd.c | 7 | ||||
-rw-r--r-- | lib/util/util_strlist.c | 2 |
4 files changed, 13 insertions, 6 deletions
diff --git a/lib/util/parmlist.c b/lib/util/parmlist.c index 0f2f3af8ee..b3e1e9fc48 100644 --- a/lib/util/parmlist.c +++ b/lib/util/parmlist.c @@ -74,11 +74,14 @@ const char **parmlist_get_string_list(struct parmlist *ctx, const char *name, const char *separator) { struct parmlist_entry *p = parmlist_get(ctx, name); + char **l; - if (p == NULL) + if (p == NULL) { return NULL; + } - return (const char **)str_list_make(ctx, p->value, separator); + l = str_list_make(ctx, p->value, separator); + return discard_const_p(const char *, l); } static struct parmlist_entry *parmlist_get_add(struct parmlist *ctx, const char *name) diff --git a/lib/util/tevent_debug.c b/lib/util/tevent_debug.c index 3f8c649a0b..bfbaed648e 100644 --- a/lib/util/tevent_debug.c +++ b/lib/util/tevent_debug.c @@ -67,7 +67,8 @@ static void samba_tevent_debug(void *context, void samba_tevent_set_debug(struct tevent_context *ev, const char *name) { - tevent_set_debug(ev, samba_tevent_debug, name); + void *p = discard_const(name); + tevent_set_debug(ev, samba_tevent_debug, p); } struct tevent_context *samba_tevent_context_init(TALLOC_CTX *mem_ctx) diff --git a/lib/util/util_runcmd.c b/lib/util/util_runcmd.c index bc5cc10a8b..c8547de694 100644 --- a/lib/util/util_runcmd.c +++ b/lib/util/util_runcmd.c @@ -204,13 +204,16 @@ struct tevent_req *samba_runcmd_send(TALLOC_CTX *mem_ctx, va_start(ap, argv0); while (1) { + const char **l; char *arg = va_arg(ap, char *); if (arg == NULL) break; - argv = discard_const_p(char *, str_list_add((const char **)argv, arg)); - if (!argv) { + l = discard_const_p(const char *, argv); + l = str_list_add(l, arg); + if (l == NULL) { fprintf(stderr, "Out of memory in child\n"); _exit(255); } + argv = discard_const_p(char *, l); } va_end(ap); diff --git a/lib/util/util_strlist.c b/lib/util/util_strlist.c index e8d2a74221..8397589d74 100644 --- a/lib/util/util_strlist.c +++ b/lib/util/util_strlist.c @@ -519,6 +519,6 @@ _PUBLIC_ const char **str_list_copy_const(TALLOC_CTX *mem_ctx, */ _PUBLIC_ const char **const_str_list(char **list) { - return (const char **)list; + return discard_const_p(const char *, list); } |