chiark / gitweb /
log: be a bit less wasteful when allocating buffers
authorLennart Poettering <lennart@poettering.net>
Thu, 27 Nov 2014 18:52:27 +0000 (19:52 +0100)
committerLennart Poettering <lennart@poettering.net>
Thu, 27 Nov 2014 21:05:24 +0000 (22:05 +0100)
src/shared/log.c

index ba959b9..d87f43f 100644 (file)
@@ -366,7 +366,7 @@ static int write_to_syslog(
                 const char *object,
                 const char *buffer) {
 
-        char header_priority[16], header_time[64], header_pid[16];
+        char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_time[64], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];
         struct iovec iovec[5] = {};
         struct msghdr msghdr = {
                 .msg_iov = iovec,
@@ -429,7 +429,7 @@ static int write_to_kmsg(
                 const char *object,
                 const char *buffer) {
 
-        char header_priority[16], header_pid[16];
+        char header_priority[1 + DECIMAL_STR_MAX(int) + 2], header_pid[1 + DECIMAL_STR_MAX(pid_t) + 4];
         struct iovec iovec[5] = {};
 
         if (kmsg_fd < 0)