* src/tar.c: Include io.h for setmode(). (main): Set stdin/stdout to binary mode on OS/2 if not console. --- src/tar.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
diff --git a/src/tar.c b/src/tar.c index 7512e98..8c50607 100644 --- a/src/tar.c +++ b/src/tar.c @@ -53,6 +53,10 @@ #include <priv-set.h> #include <savedir.h> +#ifdef __OS2__ +# include <io.h> /* setmode() */ +#endif + /* Local declarations. */ #ifndef DEFAULT_ARCHIVE_FORMAT @@ -2743,6 +2747,15 @@ main (int argc, char **argv) /* Make sure we have first three descriptors available */ stdopen (); +#ifdef __OS2__ + /* Set stdin/out to binary mode if it is not a console */ + if (!isatty (fileno (stdin))) + setmode (fileno (stdin), O_BINARY); + + if (!isatty (fileno (stdout))) + setmode (fileno (stdout), O_BINARY); +#endif + /* Pre-allocate a few structures. */ allocated_archive_names = 10; -- 1.8.5.2