cpio (2.11-4) debian-changes-2.11-4

Summary

 gnu/fcntl.in.h    |    5 ++++-
 lib/rtapelib.c    |    2 ++
 lib/sysdep.c      |   10 +++++++++-
 lib/sysdep.h      |    4 +++-
 lib/system.h      |    5 -----
 po/Makefile.in.in |    2 --
 src/Makefile.am   |    2 ++
 src/copyout.c     |   13 ++++++++-----
 src/filetypes.h   |    3 +++
 src/main.c        |    2 ++
 src/mt.c          |    4 +++-
 11 files changed, 36 insertions(+), 16 deletions(-)

    
download this patch

Patch contents

Description: Upstream changes introduced in version 2.11-4
 This patch has been created by dpkg-source during the package build.
 Here's the last changelog entry, hopefully it gives details on why
 those changes were made:
 .
 cpio (2.11-4) unstable; urgency=low
 .
   * Apply patch from Didier Raboud to fix win32 output again.
     closes: #579533.
 .
 The person named in the Author field signed this changelog entry.
Author: Clint Adams <schizo@debian.org>
Bug-Debian: http://bugs.debian.org/579533

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- cpio-2.11.orig/po/Makefile.in.in
+++ cpio-2.11/po/Makefile.in.in
@@ -1,5 +1,3 @@
-# -*- buffer-read-only: t -*- vi: set ro:
-# DO NOT EDIT! GENERATED AUTOMATICALLY!
 # Makefile for PO directory in any package using GNU gettext.
 # Copyright (C) 1995-1997, 2000-2007 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
 #
--- cpio-2.11.orig/lib/sysdep.h
+++ cpio-2.11/lib/sysdep.h
@@ -20,6 +20,8 @@
    You should have received a copy of the GNU General Public License
    along with GNU cpiio.  If not, see <http://www.gnu.org/licenses/>. */
 
+#ifndef LIB_SYSDEP_H
+#define LIB_SYSDEP_H 1
 
 #ifdef HAVE_PROCESS_H
 # include <process.h>
@@ -141,4 +143,4 @@ int link (const char *oldname,const char
 int chown (const char *filename,int owner,int group);
 #endif
 
-
+#endif
--- cpio-2.11.orig/lib/rtapelib.c
+++ cpio-2.11/lib/rtapelib.c
@@ -425,7 +425,9 @@ rmt_open__ (const char *file_name, int o
   }
 
   /* FIXME: Should somewhat validate the decoding, here.  */
+#ifndef __WIN32__
   if (gethostbyname (remote_host) == NULL)
+#endif
     error (EXIT_ON_EXEC_ERROR, 0, _("Cannot connect to %s: resolve failed"),
 	   remote_host);
 	  
--- cpio-2.11.orig/lib/sysdep.c
+++ cpio-2.11/lib/sysdep.c
@@ -187,4 +187,12 @@ chown ( const char *filename __attribute
   return -1;
 }
 #endif
-
+#ifdef __WIN32__
+# warning "Providing stub placeholder for readlink function"
+int
+readlink ( const char *path __attribute__ ((unused)) ,  char *buf __attribute__ ((unused)) ,  size_t bufsiz __attribute__ ((unused)) )
+{
+  errno = ENOSYS;
+  return -1;
+}
+#endif
--- cpio-2.11.orig/lib/system.h
+++ cpio-2.11/lib/system.h
@@ -109,9 +109,6 @@ extern int errno;
 # define O_TRUNC	32	/* truncate file on open */
 #endif
 
-#ifndef O_BINARY
-# define O_BINARY 0
-#endif
 #ifndef O_DIRECTORY
 # define O_DIRECTORY 0
 #endif
@@ -462,13 +459,11 @@ char *getenv ();
 
 #if MSDOS
 # include <process.h>
-# define SET_BINARY_MODE(arc) setmode(arc, O_BINARY)
 # define ERRNO_IS_EACCES errno == EACCES
 # define mkdir(file, mode) (mkdir) (file)
 # define TTY_NAME "con"
 # define sys_reset_uid_gid()
 #else
-# define SET_BINARY_MODE(arc)
 # define ERRNO_IS_EACCES 0
 # define TTY_NAME "/dev/tty"
 # define sys_reset_uid_gid() \
--- cpio-2.11.orig/gnu/fcntl.in.h
+++ cpio-2.11/gnu/fcntl.in.h
@@ -234,7 +234,10 @@ _GL_WARN_ON_USE (openat, "openat is not
 # undef O_TEXT
 #endif
 
-#ifndef O_BINARY
+#ifdef O_BINARY
+# define SET_BINARY_MODE(arc) setmode(arc, O_BINARY)
+#else
+# define SET_BINARY_MODE(arc)
 # define O_BINARY 0
 # define O_TEXT 0
 #endif
--- cpio-2.11.orig/src/filetypes.h
+++ cpio-2.11/src/filetypes.h
@@ -81,5 +81,8 @@
 #ifndef S_ISLNK
 #define lstat stat
 #endif
+
+#ifndef __WIN32__
 int lstat ();
 int stat ();
+#endif
--- cpio-2.11.orig/src/Makefile.am
+++ cpio-2.11/src/Makefile.am
@@ -38,6 +38,8 @@ cpio_SOURCES = \
  makepath.c\
  userspec.c
 
+mt_SOURCES = mt.c
+
 noinst_HEADERS =\
  cpio.h\
  cpiohdr.h\
--- cpio-2.11.orig/src/main.c
+++ cpio-2.11/src/main.c
@@ -734,6 +734,8 @@ main (int argc, char *argv[])
   
   initialize_buffers ();
 
+  SET_BINARY_MODE (1);
+
   (*copy_function) ();
 
   if (archive_des >= 0 && rmtclose (archive_des) == -1)
--- cpio-2.11.orig/src/copyout.c
+++ cpio-2.11/src/copyout.c
@@ -232,7 +232,8 @@ writeout_defered_file (struct cpio_file_
 			   header->c_name);
   warn_if_file_changed(header->c_name, file_hdr.c_filesize, file_hdr.c_mtime);
 
-  if (archive_format == arf_tar || archive_format == arf_ustar)
+  if ((archive_format == arf_tar || archive_format == arf_ustar)
+      && (file_hdr.c_nlink > 1))
     add_inode (file_hdr.c_ino, file_hdr.c_name, file_hdr.c_dev_maj,
 	       file_hdr.c_dev_min);
 
@@ -651,7 +652,7 @@ process_copy_out ()
 	  
 	  if (archive_format == arf_tar || archive_format == arf_ustar)
 	    {
-	      if (file_hdr.c_mode & CP_IFDIR)
+             if ((file_hdr.c_mode & CP_IFMT) == CP_IFDIR)
 		{
 		  int len = strlen (input_name.ds_string);
 		  /* Make sure the name ends with a slash */
@@ -695,7 +696,8 @@ process_copy_out ()
 	  switch (file_hdr.c_mode & CP_IFMT)
 	    {
 	    case CP_IFREG:
-	      if (archive_format == arf_tar || archive_format == arf_ustar)
+             if ((archive_format == arf_tar || archive_format == arf_ustar)
+                 && (file_hdr.c_nlink > 1))
 		{
 		  char *otherfile;
 		  if ((otherfile = find_inode_file (file_hdr.c_ino,
@@ -742,7 +744,8 @@ process_copy_out ()
 	      warn_if_file_changed(orig_file_name, file_hdr.c_filesize,
                                    file_hdr.c_mtime);
 
-	      if (archive_format == arf_tar || archive_format == arf_ustar)
+             if ((archive_format == arf_tar || archive_format == arf_ustar)
+                 && (file_hdr.c_nlink > 1))
 		add_inode (file_hdr.c_ino, orig_file_name, file_hdr.c_dev_maj,
 			   file_hdr.c_dev_min);
 
@@ -776,7 +779,7 @@ process_copy_out ()
 			 orig_file_name);
 		  continue;
 		}
-	      else if (archive_format == arf_ustar)
+             else if ((archive_format == arf_ustar) && (file_hdr.c_nlink > 1))
 		{
 		  char *otherfile;
 		  if ((otherfile = find_inode_file (file_hdr.c_ino,
--- cpio-2.11.orig/src/mt.c
+++ cpio-2.11/src/mt.c
@@ -55,6 +55,8 @@
 
    David MacKenzie <djm@gnu.ai.mit.edu> */
 
+#include "configmake.h"
+
 #include <system.h>
 
 #include <stdio.h>
@@ -308,7 +310,7 @@ print_status (char *dev, int desc)
 void
 fatal_exit ()
 {
-  exit (MT_EXIT_INVOP);
+  exit (MT_EXIT_FAILURE);
 }
 
 int