diff -ur cpio-2.9.old/lib/fcntl_.h cpio-2.9/lib/fcntl_.h --- cpio-2.9.old/lib/fcntl_.h 2007-06-28 19:18:55.000000000 +0200 +++ cpio-2.9/lib/fcntl_.h 2008-02-05 17:00:24.000000000 +0100 @@ -111,7 +111,10 @@ # 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 diff -ur cpio-2.9.old/lib/system.h cpio-2.9/lib/system.h --- cpio-2.9.old/lib/system.h 2008-02-05 14:03:34.000000000 +0100 +++ cpio-2.9/lib/system.h 2008-02-05 17:00:37.000000000 +0100 @@ -109,9 +109,6 @@ # 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 @@ -490,13 +487,11 @@ #endif #if MSDOS -# 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() \ diff -ur cpio-2.9.old/src/main.c cpio-2.9/src/main.c --- cpio-2.9.old/src/main.c 2007-06-28 12:46:41.000000000 +0200 +++ cpio-2.9/src/main.c 2008-02-05 17:03:48.000000000 +0100 @@ -792,6 +792,8 @@ initialize_buffers (); + SET_BINARY_MODE (1); + (*copy_function) (); if (archive_des >= 0 && rmtclose (archive_des) == -1)