Use vdprintf() instead of the dup dup. - geomyidae - A small C-based gopherd. HTML git clone git://bitreich.org/geomyidae/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/geomyidae/ DIR Log DIR Files DIR Refs DIR Tags DIR README DIR LICENSE --- DIR commit 93c55f39d5bd322b6dc9bf13fb2025264dc52341 DIR parent c98811c741255305b3fbff36a7b06bfb263d3ebc HTML Author: Christoph Lohmann <20h@r-36.net> Date: Sun, 11 Jun 2017 19:24:16 +0200 Use vdprintf() instead of the dup dup. Diffstat: M ind.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) --- DIR diff --git a/ind.c b/ind.c @@ -281,22 +281,11 @@ void tprintf(int fd, char *fmt, ...) { va_list fmtargs; - int fd2; - FILE *fp; - - fd2 = dup(fd); - fp = fdopen(fd2, "w"); - if(fp == nil) { - perror("fdopen"); - return; - } va_start(fmtargs, fmt); - vfprintf(fp, fmt, fmtargs); + vdprintf(fd, fmt, fmtargs); va_end(fmtargs); - fclose(fp); - return; }