diff options
-rw-r--r-- | usr.bin/tmux/environ.c | 12 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/usr.bin/tmux/environ.c b/usr.bin/tmux/environ.c index 5751ab88a63..ef94750bd18 100644 --- a/usr.bin/tmux/environ.c +++ b/usr.bin/tmux/environ.c @@ -1,4 +1,4 @@ -/* $OpenBSD: environ.c,v 1.19 2017/04/25 15:35:10 nicm Exp $ */ +/* $OpenBSD: environ.c,v 1.20 2017/05/11 07:34:54 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -208,9 +208,15 @@ environ_push(struct environ *env) /* Log the environment. */ void -environ_log(struct environ *env, const char *prefix) +environ_log(struct environ *env, const char *fmt, ...) { struct environ_entry *envent; + va_list ap; + char *prefix; + + va_start(ap, fmt); + vasprintf(&prefix, fmt, ap); + va_end(ap); RB_FOREACH(envent, environ, env) { if (envent->value != NULL && *envent->name != '\0') { @@ -218,6 +224,8 @@ environ_log(struct environ *env, const char *prefix) envent->value); } } + + free(prefix); } /* Create initial environment for new child. */ diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 91cec8787e5..4baa3061c77 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.763 2017/05/10 16:48:36 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.764 2017/05/11 07:34:54 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1621,7 +1621,7 @@ void environ_put(struct environ *, const char *); void environ_unset(struct environ *, const char *); void environ_update(struct options *, struct environ *, struct environ *); void environ_push(struct environ *); -void environ_log(struct environ *, const char *); +void printflike(2, 3) environ_log(struct environ *, const char *, ...); struct environ *environ_for_session(struct session *, int); /* tty.c */ |