300-006_better_file_error.patch 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh -e
  2. ## 006_better_file_error.dpatch by David Kimdon <[email protected]>
  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. Index: binutils-2.18/bfd/opncls.c
  23. ===================================================================
  24. --- binutils-2.18.orig/bfd/opncls.c 2007-06-28 09:19:34.818943168 +0200
  25. +++ binutils-2.18/bfd/opncls.c 2007-06-28 09:19:35.993764568 +0200
  26. @@ -183,6 +183,13 @@
  27. {
  28. bfd *nbfd;
  29. const bfd_target *target_vec;
  30. + struct stat s;
  31. +
  32. + if (stat (filename, &s) == 0)
  33. + if (S_ISDIR(s.st_mode)) {
  34. + bfd_set_error (bfd_error_file_not_recognized);
  35. + return NULL;
  36. + }
  37. nbfd = _bfd_new_bfd ();
  38. if (nbfd == NULL)