]> git.ipfire.org Git - thirdparty/dhcpcd.git/commitdiff
logerr: buffer stderr as we now have many processes
authorRoy Marples <roy@marples.name>
Tue, 9 Jun 2020 16:49:51 +0000 (17:49 +0100)
committerRoy Marples <roy@marples.name>
Tue, 9 Jun 2020 16:49:51 +0000 (17:49 +0100)
src/logerr.c

index c4d0462a0c8052b34637a2741d97349bddf72d9e..1c5217cd3e495c7818d8a838186307e447ddb4ce 100644 (file)
@@ -50,6 +50,7 @@
 #define UNUSED(a)              (void)(a)
 
 struct logctx {
+       char             log_buf[BUFSIZ];
        unsigned int     log_opts;
 #ifndef SMALL
        FILE            *log_file;
@@ -369,6 +370,9 @@ logopen(const char *path)
        /* Cache timezone */
        tzset();
 
+       if (setvbuf(stderr, ctx->log_buf, _IOLBF, sizeof(ctx->log_buf)) == -1)
+               fprintf(stderr, "%s: %s\n", __func__, strerror(errno));
+
        if (path == NULL) {
                int opts = 0;