[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-cpio] Re: Bug#579533: cpio-win32: cpio.exe changed output format, w
From: |
Clint Adams |
Subject: |
[Bug-cpio] Re: Bug#579533: cpio-win32: cpio.exe changed output format, which breaks initrd.gz editing |
Date: |
Wed, 28 Apr 2010 18:44:25 +0000 |
User-agent: |
Mutt/1.5.18 (2008-05-17) |
On Wed, Apr 28, 2010 at 08:29:22PM +0200, Didier 'OdyX' Raboud wrote:
> Hrm… I'm nowhere near familiar to win32 nor with C, but I'm interested in
> getting this fixed: count me as responsible for this bug: I'll hunt it down
> seriously. Not just now, but seriously.
These are the patches we're carrying against upstream. I'm not sure what
would corrupt the win32 output as you're seeing.
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index cb645db..1be92f7 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -425,7 +425,9 @@ rmt_open__ (const char *file_name, int open_mode, int bias,
}
/* 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);
diff --git a/lib/sysdep.c b/lib/sysdep.c
index 5da330a..3174f27 100644
--- a/lib/sysdep.c
+++ b/lib/sysdep.c
@@ -187,4 +187,12 @@ chown ( const char *filename __attribute__ ((unused)) ,
int owner __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
diff --git a/lib/sysdep.h b/lib/sysdep.h
index 32cb52e..eb2d237 100644
--- a/lib/sysdep.h
+++ b/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 *newname);
int chown (const char *filename,int owner,int group);
#endif
-
+#endif
diff --git a/po/Makefile.in.in b/po/Makefile.in.in
index be0ca59..fecf500 100644
--- a/po/Makefile.in.in
+++ b/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 <address@hidden>
#
diff --git a/src/Makefile.am b/src/Makefile.am
index ec71397..80cd390 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,6 +38,8 @@ cpio_SOURCES = \
makepath.c\
userspec.c
+mt_SOURCES = mt.c
+
noinst_HEADERS =\
cpio.h\
cpiohdr.h\
diff --git a/src/copyout.c b/src/copyout.c
index 7e6b624..96d3fb9 100644
--- a/src/copyout.c
+++ b/src/copyout.c
@@ -232,7 +232,8 @@ writeout_defered_file (struct cpio_file_stat *header, int
out_file_des)
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,
diff --git a/src/filetypes.h b/src/filetypes.h
index f80faab..91fbba4 100644
--- a/src/filetypes.h
+++ b/src/filetypes.h
@@ -81,5 +81,8 @@
#ifndef S_ISLNK
#define lstat stat
#endif
+
+#ifndef __WIN32__
int lstat ();
int stat ();
+#endif
diff --git a/src/main.c b/src/main.c
index ba1b969..4400357 100644
--- a/src/main.c
+++ b/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)
diff --git a/src/mt.c b/src/mt.c
index a25e1bb..2f690fe 100644
--- a/src/mt.c
+++ b/src/mt.c
@@ -55,6 +55,8 @@
David MacKenzie <address@hidden> */
+#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
- [Bug-cpio] Re: Bug#579533: cpio-win32: cpio.exe changed output format, which breaks initrd.gz editing,
Clint Adams <=