summaryrefslogtreecommitdiff
path: root/src/od.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-07-11 18:24:14 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-07-11 18:24:14 +0000
commita40f69da685d71f86fe4407d28db5ae9fde25ca0 (patch)
treeb04dce47d99363690bf79daa440cad55b13a37c1 /src/od.c
parent6560de0b044d64c000775b197515c6d7d991c938 (diff)
downloadcoreutils-a40f69da685d71f86fe4407d28db5ae9fde25ca0.tar.xz
(open_next_file): Avoid setmode; use POSIX-specified routines instead.
Diffstat (limited to 'src/od.c')
-rw-r--r--src/od.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/od.c b/src/od.c
index 651ebf29a..667beb8a5 100644
--- a/src/od.c
+++ b/src/od.c
@@ -899,10 +899,12 @@ open_next_file (void)
input_filename = _("standard input");
in_stream = stdin;
have_read_stdin = true;
+ if (O_BINARY && ! isatty (STDIN_FILENO))
+ freopen (NULL, "rb", stdin);
}
else
{
- in_stream = fopen (input_filename, "r");
+ in_stream = fopen (input_filename, (O_BINARY ? "rb" : "r"));
if (in_stream == NULL)
{
error (0, errno, "%s", input_filename);
@@ -914,7 +916,6 @@ open_next_file (void)
if (limit_bytes_to_format & !flag_dump_strings)
SETVBUF (in_stream, NULL, _IONBF, 0);
- SET_BINARY (fileno (in_stream));
return ok;
}