From: David Kimdon Date: Fri, 15 May 2020 09:49:49 +0000 (+0100) Subject: Specify which filename is causing an error if the filename is a X-Git-Tag: archive/raspbian/2.34-8+rpi1^2~17 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=9811bbb4c5cec4995aab5869411f4ba6163774a0;p=binutils.git Specify which filename is causing an error if the filename is a directory. (#45832) Gbp-Pq: Name 006_better_file_error.patch --- diff --git a/bfd/opncls.c b/bfd/opncls.c index a03ad51c8..c89226c70 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -196,6 +196,13 @@ bfd_fopen (const char *filename, const char *target, const char *mode, int fd) { bfd *nbfd; const bfd_target *target_vec; + struct stat s; + + if (stat (filename, &s) == 0) + if (S_ISDIR(s.st_mode)) { + bfd_set_error (bfd_error_file_not_recognized); + return NULL; + } nbfd = _bfd_new_bfd (); if (nbfd == NULL)