From: David Kimdon Date: Fri, 18 Feb 2022 04:46:44 +0000 (+0000) Subject: Specify which filename is causing an error if the filename is a X-Git-Tag: archive/raspbian/2.38-2+rpi1^2~18 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=e7ac7eb1d7940ac3447d39ac50cdc3e9208ec951;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 f0ca9048f..00333a4d3 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -222,6 +222,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)