patches/binutils/2.20.1/270-better_file_error.patch
changeset 2088 4f21ba5f8e91
parent 1700 eccc37dd1a25
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/binutils/2.20.1/270-better_file_error.patch	Tue Aug 17 19:48:49 2010 +0200
     1.3 @@ -0,0 +1,45 @@
     1.4 +#!/bin/sh -e
     1.5 +## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
     1.6 +##
     1.7 +## All lines beginning with `## DP:' are a description of the patch.
     1.8 +## DP: Specify which filename is causing an error if the filename is a
     1.9 +## DP: directory. (#45832)
    1.10 +
    1.11 +if [ $# -ne 1 ]; then
    1.12 +    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    1.13 +    exit 1
    1.14 +fi
    1.15 +
    1.16 +[ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
    1.17 +patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
    1.18 +
    1.19 +case "$1" in
    1.20 +       -patch) patch $patch_opts -p1 < $0;;
    1.21 +       -unpatch) patch $patch_opts -p1 -R < $0;;
    1.22 +        *)
    1.23 +                echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    1.24 +                exit 1;;
    1.25 +esac
    1.26 +
    1.27 +exit 0
    1.28 +
    1.29 +@DPATCH@
    1.30 +diff -urNad /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c binutils-2.14.90.0.6/bfd/opncls.c
    1.31 +
    1.32 +diff -durN binutils-2.20.1.orig/bfd/opncls.c binutils-2.20.1/bfd/opncls.c
    1.33 +--- binutils-2.20.1.orig/bfd/opncls.c	2010-01-14 11:48:22.000000000 +0100
    1.34 ++++ binutils-2.20.1/bfd/opncls.c	2010-08-17 19:32:23.000000000 +0200
    1.35 +@@ -183,6 +183,13 @@
    1.36 + {
    1.37 +   bfd *nbfd;
    1.38 +   const bfd_target *target_vec;
    1.39 ++  struct stat s;
    1.40 ++
    1.41 ++  if (stat (filename, &s) == 0)
    1.42 ++    if (S_ISDIR(s.st_mode)) {
    1.43 ++      bfd_set_error (bfd_error_file_not_recognized);
    1.44 ++      return NULL;
    1.45 ++    }
    1.46 + 
    1.47 +   nbfd = _bfd_new_bfd ();
    1.48 +   if (nbfd == NULL)