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:
@@ -230,9 +230,6 @@ static void SendRepeat(Out& o, char ch, int count) {
|
||||
/* Perform formatted output to an output target 'o' */
|
||||
template <typename Out>
|
||||
static void out_vformat(Out& o, const char* format, va_list args) {
|
||||
#if 0
|
||||
int caller_errno = errno;
|
||||
#endif
|
||||
int nn = 0;
|
||||
|
||||
for (;;) {
|
||||
@@ -381,11 +378,6 @@ static void out_vformat(Out& o, const char* format, va_list args) {
|
||||
} else if (c == '%') {
|
||||
buffer[0] = '%';
|
||||
buffer[1] = '\0';
|
||||
#if 0
|
||||
} else if (c == 'm') {
|
||||
// syslog-like %m for strerror(errno).
|
||||
str = strerror(caller_errno);
|
||||
#endif
|
||||
} else {
|
||||
__assert(__FILE__, __LINE__, "conversion specifier unsupported");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user