aboutsummaryrefslogtreecommitdiff
path: root/environ.c
diff options
context:
space:
mode:
Diffstat (limited to 'environ.c')
-rw-r--r--environ.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/environ.c b/environ.c
index d884330e..29191ee5 100644
--- a/environ.c
+++ b/environ.c
@@ -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. */