#! /bin/sh -e
## 116_ar_nonexistent_files.dpatch
##
## DP: Description: Fix ar to error out on non-existent files. (#267139)
## DP: Author: Nick Clifton  <nickc@redhat.com>
## DP: Upstream status: Committed to trunk
## DP: Date: 2004-09-09
## DP: URL: http://sources.redhat.com/bugzilla/show_bug.cgi?id=363#c2

if [ $# -lt 1 ]; then
    echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
    exit 1
fi

[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
patch_opts="${patch_opts:--f --no-backup-if-mismatch} ${2:+-d $2}"

case "$1" in
    -patch) patch -p1 ${patch_opts} < $0;;
    -unpatch) patch -R -p1 ${patch_opts} < $0;;
    *)
        echo "`basename $0`: script expects -patch|-unpatch as argument" >&2
        exit 1;;
esac

exit 0

@DPATCH@
diff -urNad /home/james/debian/packages/binutils/binutils-2.15/binutils/ar.c binutils-2.15/binutils/ar.c
--- /home/james/debian/packages/binutils/binutils-2.15/binutils/ar.c	2004-05-17 20:35:50.000000000 +0100
+++ binutils-2.15/binutils/ar.c	2004-09-09 18:12:49.613666653 +0100
@@ -1325,8 +1325,7 @@
       /* Add to the end of the archive.  */
       after_bfd = get_pos_bfd (&arch->next, pos_end, NULL);
 
-      if (get_file_size (* files_to_move) > 0
-	  && ar_emul_append (after_bfd, *files_to_move, verbose))
+      if (ar_emul_append (after_bfd, *files_to_move, verbose))
 	changed = TRUE;
 
     next_file:;
