diff options
Diffstat (limited to 'src/tail.c')
-rw-r--r-- | src/tail.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/tail.c b/src/tail.c index b24757f3d..dbd210458 100644 --- a/src/tail.c +++ b/src/tail.c @@ -43,9 +43,9 @@ #include "safe-read.h" #include "stat-size.h" #include "stat-time.h" -#include "xfreopen.h" #include "xnanosleep.h" #include "xdectoint.h" +#include "xsetmode.h" #include "xstrtol.h" #include "xstrtod.h" @@ -1894,8 +1894,7 @@ tail_file (struct File_spec *f, uintmax_t n_units) { have_read_stdin = true; fd = STDIN_FILENO; - if (O_BINARY && ! isatty (STDIN_FILENO)) - xfreopen (NULL, "rb", stdin); + xsetmode (STDIN_FILENO, O_BINARY); } else fd = open (f->name, O_RDONLY | O_BINARY); @@ -2324,8 +2323,7 @@ main (int argc, char **argv) || (header_mode == multiple_files && n_files > 1)) print_headers = true; - if (O_BINARY && ! isatty (STDOUT_FILENO)) - xfreopen (NULL, "wb", stdout); + xsetmode (STDOUT_FILENO, O_BINARY); for (i = 0; i < n_files; i++) ok &= tail_file (&F[i], n_units); |