--- origsrc/tar-1.33/lib/rmt.h
+++ src/tar-1.33/lib/rmt.h
@@ -62,7 +62,7 @@ extern bool force_local_option;
 #define rmtcreat(dev_name, mode, command) \
    (_remdev (dev_name) \
     ? rmt_open__ (dev_name, O_CREAT | O_WRONLY, __REM_BIAS, command) \
-    : creat (dev_name, mode))
+    : open (dev_name, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, mode))
 
 #define rmtlstat(dev_name, muffer) \
   (_remdev (dev_name) ? (errno = EOPNOTSUPP), -1 : lstat (dev_name, buffer))
--- origsrc/tar-1.33/rmt/rmt.c
+++ src/tar-1.33/rmt/rmt.c
@@ -336,7 +336,7 @@ open_device (char *str)
       if (device_fd >= 0)
 	close (device_fd);
 
-      device_fd = open (device, flag, MODE_RW);
+      device_fd = open (device, flag | O_BINARY, MODE_RW);
       if (device_fd < 0)
 	rmt_error (errno);
       else
--- origsrc/tar-1.33/src/buffer.c
+++ src/tar-1.33/src/buffer.c
@@ -770,6 +770,7 @@ _open_archive (enum access_mode wanted_a
             enum compress_type type;
 
             archive = STDIN_FILENO;
+            freopen (NULL, "rb", stdin);
             type = check_compressed_archive (&shortfile);
             if (type != ct_tar && type != ct_none)
               FATAL_ERROR ((0, 0,
@@ -782,12 +783,19 @@ _open_archive (enum access_mode wanted_a
 
         case ACCESS_WRITE:
           archive = STDOUT_FILENO;
+          freopen (NULL,
+                   fcntl (STDOUT_FILENO, F_GETFL) & O_APPEND ? "ab" : "wb",
+                   stdout);
           if (!index_file_name)
             stdlis = stderr;
           break;
 
         case ACCESS_UPDATE:
           archive = STDIN_FILENO;
+          freopen (NULL, "rb", stdin);
+          freopen (NULL,
+                   fcntl (STDOUT_FILENO, F_GETFL) & O_APPEND ? "ab" : "wb",
+                   stdout);
           write_archive_to_stdout = true;
           record_end = record_start; /* set up for 1st record = # 0 */
           if (!index_file_name)
@@ -1162,7 +1170,7 @@ init_volume_number (void)
 void
 closeout_volume_number (void)
 {
-  FILE *file = fopen (volno_file_option, "w");
+  FILE *file = fopen (volno_file_option, "wb");
 
   if (file)
     {
--- origsrc/tar-1.33/src/incremen.c
+++ src/tar-1.33/src/incremen.c
@@ -1333,7 +1333,7 @@ read_directory_file (void)
   int fd;
   char *buf = NULL;
   size_t bufsize = 0;
-  int flags = O_RDWR | O_CREAT;
+  int flags = O_RDWR | O_CREAT | O_BINARY;
 
   if (incremental_level == 0)
     flags |= O_TRUNC;
@@ -1347,7 +1347,7 @@ read_directory_file (void)
       return;
     }
 
-  listed_incremental_stream = fdopen (fd, "r+");
+  listed_incremental_stream = fdopen (fd, "rb+");
   if (! listed_incremental_stream)
     {
       open_error (listed_incremental_option);
--- origsrc/tar-1.33/src/system.c
+++ src/tar-1.33/src/system.c
@@ -386,7 +386,8 @@ sys_child_open_for_compress (void)
 	 compressor.  */
       if (strcmp (archive_name_array[0], "-"))
 	{
-	  archive = creat (archive_name_array[0], MODE_RW);
+	  archive = open (archive_name_array[0],
+			  O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, MODE_RW);
 	  if (archive < 0)
 	    {
 	      int saved_errno = errno;
@@ -427,7 +428,11 @@ sys_child_open_for_compress (void)
   xclose (child_pipe[PWRITE]);
 
   if (strcmp (archive_name_array[0], "-") == 0)
-    archive = STDOUT_FILENO;
+    {
+      archive = STDOUT_FILENO;
+      freopen (NULL, fcntl (STDOUT_FILENO, F_GETFL) & O_APPEND ? "ab" : "wb",
+	       stdout);
+    }
   else
     {
       archive = rmtcreat (archive_name_array[0], MODE_RW, rsh_command_option);
