Use vsnprintf(3) in syslog(3).

It seemed like a clever trick to use the internal log message formatting
code in syslog(3), but on reflection that means you can't (for example)
format floating point numbers. This patch switches us over to using good
old vsnprintf(3), even though that requires us to jump through a few hoops.

There's no obvious way to unit test this, so I wrote a little program and
ran that.

Bug: 14292866
Change-Id: I9c83500ba9cbb209b6f496067a91bf69434eeef5
This commit is contained in:
Elliott Hughes
2014-07-25 20:31:47 -07:00
parent c1a6a72560
commit b1b60c30bf
3 changed files with 48 additions and 25 deletions

View File

@@ -176,14 +176,3 @@ TEST(libc_logging, lld_LLONG_MIN) {
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif // __BIONIC__
}
TEST(libc_logging, m) {
#if defined(__BIONIC__)
char buf[BUFSIZ];
errno = EBADF;
__libc_format_buffer(buf, sizeof(buf), "<%m>");
EXPECT_STREQ("<Bad file number>", buf);
#else // __BIONIC__
GTEST_LOG_(INFO) << "This test does nothing.\n";
#endif // __BIONIC__
}