]> granicus.if.org Git - strace/commitdiff
Do not allocate memory for line buffered output
authorDmitry V. Levin <ldv@altlinux.org>
Sun, 4 Dec 2016 18:36:31 +0000 (18:36 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sun, 4 Dec 2016 23:09:18 +0000 (23:09 +0000)
libc is perfectly capable of allocating memory for its buffers,
so let it do its job.

* strace.c (init): Do not allocate memory for setvbuf invocation.

strace.c

index f916e325c680a537c81b7e62f8e930d0112067ef..df1ec3e39e27dc764200e97e12c9385d60661667 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1834,8 +1834,7 @@ init(int argc, char *argv[])
        }
 
        if (!outfname || outfname[0] == '|' || outfname[0] == '!') {
-               char *buf = xmalloc(BUFSIZ);
-               setvbuf(shared_log, buf, _IOLBF, BUFSIZ);
+               setvbuf(shared_log, NULL, _IOLBF, 0);
        }
        if (outfname && argv[0]) {
                if (!opt_intr)