summaryrefslogtreecommitdiff
path: root/src/tee.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tee.c')
-rw-r--r--src/tee.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/src/tee.c b/src/tee.c
index 74477cb7e..5f04bfc86 100644
--- a/src/tee.c
+++ b/src/tee.c
@@ -27,7 +27,7 @@
#include "error.h"
#include "fadvise.h"
#include "stdio--.h"
-#include "xfreopen.h"
+#include "xsetmode.h"
/* The official name of this program (e.g., no 'g' prefix). */
#define PROGRAM_NAME "tee"
@@ -194,11 +194,8 @@ tee_files (int nfiles, char **files)
? (append ? "ab" : "wb")
: (append ? "a" : "w"));
- if (O_BINARY && ! isatty (STDIN_FILENO))
- xfreopen (NULL, "rb", stdin);
- if (O_BINARY && ! isatty (STDOUT_FILENO))
- xfreopen (NULL, "wb", stdout);
-
+ xsetmode (STDIN_FILENO, O_BINARY);
+ xsetmode (STDOUT_FILENO, O_BINARY);
fadvise (stdin, FADVISE_SEQUENTIAL);
/* Set up FILES[0 .. NFILES] and DESCRIPTORS[0 .. NFILES].