Submitted By: Jim Gifford (jim at linuxfromscratch dot org) Date: 2003-09-26 Initial Package Version: 2.5 Origin: Mandrake CVS Description: Fixes Glibc Error Fixes Man Page Install Corrects error counter diff -Naur cpio-2.5.orig/Makefile.in cpio-2.5/Makefile.in --- cpio-2.5.orig/Makefile.in 2002-06-13 04:19:58.000000000 +0000 +++ cpio-2.5/Makefile.in 2003-09-26 22:23:06.000000000 +0000 @@ -81,7 +81,8 @@ infodir = @infodir@ # Where to put the Unix-style manual pages. -mandir = @mandir@/man1 +mandir = @mandir@ +man1dir = $(mandir)/man1 # Extension (not including `.') for the Unix-style manual page filenames. manext = 1 @@ -126,16 +127,16 @@ $(INSTALL_PROGRAM) cpio $(bindir)/$(binprefix)cpio test ! -f mt || $(INSTALL_PROGRAM) mt $(bindir)/$(binprefix)mt -test ! -f rmt || $(INSTALL_PROGRAM) rmt $(libexecdir)/rmt - -$(INSTALL_DATA) $(srcdir)/cpio.1 $(mandir)/$(manprefix)cpio.$(manext) - -test ! -f mt || $(INSTALL_DATA) $(srcdir)/mt.1 $(mandir)/$(manprefix)mt.$(manext) + -$(INSTALL_DATA) $(srcdir)/cpio.1 $(man1dir)/$(manprefix)cpio.$(manext) + -test ! -f mt || $(INSTALL_DATA) $(srcdir)/mt.1 $(man1dir)/$(manprefix)mt.$(manext) installdirs: - $(srcdir)/mkinstalldirs $(bindir) $(libexecdir) $(mandir) $(infodir) + $(srcdir)/mkinstalldirs $(bindir) $(libexecdir) $(man1dir) $(infodir) uninstall:: cd $(bindir); rm -f $(binprefix)cpio $(binprefix)mt -rm -f $(libexecdir)/rmt - cd $(mandir); rm -f $(manprefix)cpio.$(manext) $(manprefix)mt.$(manext) + cd $(man1dir); rm -f $(manprefix)cpio.$(manext) $(manprefix)mt.$(manext) check: @echo No tests are supplied. diff -Naur cpio-2.5.orig/error.c cpio-2.5/error.c --- cpio-2.5.orig/error.c 2001-12-06 04:52:45.000000000 +0000 +++ cpio-2.5/error.c 2003-09-26 22:24:00.000000000 +0000 @@ -46,6 +46,10 @@ /* This variable is incremented each time `error' is called. */ unsigned int error_message_count; +/* This variable is incremented each time `error' is called and + errnum is not zero. */ +unsigned int error_count; + /* If NULL, error will flush stdout, then print on stderr the program name, a colon and a space. Otherwise, error will call this function without parameters instead. */ @@ -122,7 +126,10 @@ ++error_message_count; if (errnum) - fprintf (stderr, ": %s", strerror (errnum)); + { + fprintf (stderr, ": %s", strerror (errnum)); + error_count++; + } putc ('\n', stderr); fflush (stderr); if (status) diff -Naur cpio-2.5.orig/extern.h cpio-2.5/extern.h --- cpio-2.5.orig/extern.h 2001-12-07 01:00:45.000000000 +0000 +++ cpio-2.5/extern.h 2003-09-26 22:25:39.000000000 +0000 @@ -85,6 +85,8 @@ extern char *program_name; extern int (*xstat) (); extern void (*copy_function) (); + +extern unsigned int error_count; #if __STDC__ || defined(__MSDOS__) # define P_(s) s diff -Naur cpio-2.5.orig/main.c cpio-2.5/main.c --- cpio-2.5.orig/main.c 2001-12-06 04:54:06.000000000 +0000 +++ cpio-2.5/main.c 2003-09-26 22:24:00.000000000 +0000 @@ -531,5 +531,5 @@ if (archive_des >= 0 && rmtclose (archive_des) == -1) error (1, errno, "error closing archive"); - exit (0); + exit (error_count != 0); } diff -Naur cpio-2.5.orig/rmt.c cpio-2.5/rmt.c --- cpio-2.5.orig/rmt.c 2001-11-30 04:16:00.000000000 +0000 +++ cpio-2.5/rmt.c 2003-09-26 22:20:57.000000000 +0000 @@ -74,8 +74,13 @@ char device[SSIZE]; char count[SSIZE], mode[SSIZE], pos[SSIZE], op[SSIZE]; +#ifdef __GNU_LIBRARY__ +#include +#else extern errno; extern const char *const _sys_errlist[]; +#endif + /* Debian hack: rmt has problems on systems (such as the Hurd) where sys_errlist is not available therefore I borrowed some code from error.c to fix this problem. This has been reported to the upstream