From: David Kimdon Date: Wed, 6 Jan 2021 10:57:25 +0000 (+0000) Subject: Specify which filename is causing an error if the filename is a X-Git-Tag: archive/raspbian/2.35.1-7+rpi1^2~21 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=40d0568f60a4a1fe36dbc13da2c1d83aaf299902;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 c2a1d2fa4..f2247d0fe 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -220,6 +220,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)