300-006_better_file_error.patch 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh -e
  2. ## 006_better_file_error.dpatch by David Kimdon <dwhedon@gordian.com>
  3. ##
  4. ## All lines beginning with `## DP:' are a description of the patch.
  5. ## DP: Specify which filename is causing an error if the filename is a
  6. ## DP: directory. (#45832)
  7. if [ $# -ne 1 ]; then
  8. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  9. exit 1
  10. fi
  11. [ -f debian/patches/00patch-opts ] && . debian/patches/00patch-opts
  12. patch_opts="${patch_opts:--f --no-backup-if-mismatch}"
  13. case "$1" in
  14. -patch) patch $patch_opts -p1 < $0;;
  15. -unpatch) patch $patch_opts -p1 -R < $0;;
  16. *)
  17. echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
  18. exit 1;;
  19. esac
  20. exit 0
  21. @DPATCH@
  22. 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
  23. --- /home/james/debian/packages/binutils/binutils-2.14.90.0.6/bfd/opncls.c 2003-07-23 16:08:09.000000000 +0100
  24. +++ binutils-2.14.90.0.6/bfd/opncls.c 2003-09-10 22:35:00.000000000 +0100
  25. @@ -150,6 +150,13 @@
  26. {
  27. bfd *nbfd;
  28. const bfd_target *target_vec;
  29. + struct stat s;
  30. +
  31. + if (stat (filename, &s) == 0)
  32. + if (S_ISDIR(s.st_mode)) {
  33. + bfd_set_error (bfd_error_file_not_recognized);
  34. + return NULL;
  35. + }
  36. nbfd = _bfd_new_bfd ();
  37. if (nbfd == NULL)