summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason King <jason.brian.king@gmail.com>2017-09-19 15:26:45 +0000
committerJason King <jason.brian.king@gmail.com>2017-09-19 15:26:45 +0000
commit5f08c4f76a87c4eccd6faed949f31aae4d5c24ea (patch)
treed3d8dfcf8517b33a120d1404060ec06e68c7dfbe
parent32dd9222ea1c3fe23728af2e304518531d94cba6 (diff)
downloadillumos-joyent-5f08c4f76a87c4eccd6faed949f31aae4d5c24ea.tar.gz
OS-6341 bunyan_child adds keys to parent, not childOS-6341
-rw-r--r--usr/src/lib/libbunyan/common/bunyan.c4
-rw-r--r--usr/src/test/util-tests/tests/bunyan/btest.c4
2 files changed, 6 insertions, 2 deletions
diff --git a/usr/src/lib/libbunyan/common/bunyan.c b/usr/src/lib/libbunyan/common/bunyan.c
index 149702a38f..a442c33cec 100644
--- a/usr/src/lib/libbunyan/common/bunyan.c
+++ b/usr/src/lib/libbunyan/common/bunyan.c
@@ -559,7 +559,7 @@ bunyan_dup(const bunyan_t *b)
int
bunyan_child(const bunyan_logger_t *bhp, bunyan_logger_t **outp, ...)
{
- bunyan_t *b = (bunyan_t *)bhp;
+ const bunyan_t *b = (const bunyan_t *)bhp;
bunyan_t *n;
va_list ap;
int ret;
@@ -569,7 +569,7 @@ bunyan_child(const bunyan_logger_t *bhp, bunyan_logger_t **outp, ...)
return (ENOMEM);
va_start(ap, outp);
- ret = bunyan_key_vadd(b, &ap);
+ ret = bunyan_key_vadd(n, &ap);
va_end(ap);
if (ret != 0)
diff --git a/usr/src/test/util-tests/tests/bunyan/btest.c b/usr/src/test/util-tests/tests/bunyan/btest.c
index 5239e91f1e..f6be13afa2 100644
--- a/usr/src/test/util-tests/tests/bunyan/btest.c
+++ b/usr/src/test/util-tests/tests/bunyan/btest.c
@@ -247,6 +247,8 @@ child_log(void)
BUNYAN_T_INT64STR, "i64s", (uint64_t)12345,
BUNYAN_T_UINT64STR, "u64s", (uint64_t)54321, BUNYAN_T_END) == 0);
+ assert(bunyan_key_remove(a, "p") == ENOENT);
+
bunyan_fini(a);
assert(bunyan_trace(child, "trace", BUNYAN_T_END) == 0);
assert(bunyan_debug(child, "debug", BUNYAN_T_END) == 0);
@@ -255,6 +257,8 @@ child_log(void)
assert(bunyan_error(child, "error", BUNYAN_T_END) == 0);
assert(bunyan_fatal(child, "fatal", BUNYAN_T_END) == 0);
+ assert(bunyan_key_remove(child, "p") == 0);
+
bunyan_fini(child);
}