Hi/2.

Paul Eggert wrote:
> Sergey Poznyakoff wrote:
>> What's the purpose of this?
> 
> If it needs to be done (which isn't clear to me either), I suggest using
> the gnulib binary-io module rather than having OS/2-specific code in the
> tar sources proper.
> 
> 

It is needed because simple_flush_read() and _gnu_flush_read() use
STDIN_FILENO and STDOUT_FILENO without setting them to binary mode.

I attach patches to use SET_BINARY_MODE of paxutils.

-- 
KO Myung-Hun

Using Mozilla SeaMonkey 2.7.2
Under OS/2 Warp 4 for Korean with FixPak #15
In VirtualBox v4.1.32 on Intel Core i7-3615QM 2.30GHz with 8GB RAM

Korean OS/2 User Community : http://www.ecomstation.co.kr

From f52a12e5627e203d13335ef836ab32369d4652c5 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <k...@chollian.net>
Date: Tue, 9 Sep 2014 17:43:17 +0900
Subject: [PATCH] lib: define system macros for OS/2

* lib/system.h: Define system macros for OS/2
---
 lib/system.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/system.h b/lib/system.h
index e7f531c..b163f48 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -474,6 +474,12 @@ char *getenv ();
 # define mkdir(file, mode) (mkdir) (file)
 # define TTY_NAME "con"
 # define sys_reset_uid_gid()
+#elif defined(__OS2__)
+# include <io.h>    /* setmode(), isatty() */
+# define SET_BINARY_MODE(arc) setmode (arc, isatty (arc) ? O_TEXT : O_BINARY)
+# define ERRNO_IS_EACCES errno == EACCES
+# define TTY_NAME "con"
+# define sys_reset_uid_gid()
 #else
 # define SET_BINARY_MODE(arc)
 # define ERRNO_IS_EACCES 0
-- 
1.8.5.2

From 500b626691185ca7ecf18d72bba2bf7a5f2d7c44 Mon Sep 17 00:00:00 2001
From: KO Myung-Hun <k...@chollian.net>
Date: Tue, 18 Nov 2014 11:54:47 +0900
Subject: [PATCH] tar: make sure stdin and stdout are binary mode

Even though SET_BINARY_MODE() is called for each archive in
_open_archive() and new_volume(), simple_flush_read() and
_gnu_flush_read() use STDIN_FILENO and STDIN_FILENO without setting
them to binary mode.

* src/tar (main): Make sure stdin and stdout are binary mode.
---
 src/tar.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/tar.c b/src/tar.c
index f8102e0..c7aa3b9 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -2739,6 +2739,10 @@ main (int argc, char **argv)
   /* Make sure we have first three descriptors available */
   stdopen ();
 
+  /* Make sure stdin and stdout are binary mode */
+  SET_BINARY_MODE (STDIN_FILENO);
+  SET_BINARY_MODE (STDOUT_FILENO);
+
   /* Pre-allocate a few structures.  */
 
   allocated_archive_names = 10;
-- 
1.8.5.2

Reply via email to