File: 006_better_file_error.patch

package info (click to toggle)
binutils 2.45.50.20251023-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 380,688 kB
  • sloc: ansic: 1,510,724; asm: 826,387; cpp: 214,760; exp: 79,773; makefile: 73,112; sh: 25,521; yacc: 15,066; lisp: 13,640; perl: 13,404; lex: 1,714; ada: 1,681; python: 1,511; pascal: 1,446; cs: 879; java: 478; sed: 191; xml: 95; awk: 25
file content (19 lines) | stat: -rw-r--r-- 505 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Author: David Kimdon <dwhedon@gordian.com>
Description: Specify which filename is causing an error if the filename is a
directory. (#45832)
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -234,6 +234,13 @@ bfd_fopen (const char *filename, const c
 {
   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)