File: 006-better-file-error.patch

package info (click to toggle)
binutils-h8300-hms 2.16.1-15
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 100,908 kB
  • sloc: ansic: 702,354; asm: 261,834; exp: 45,962; makefile: 39,393; sh: 12,938; lisp: 8,454; yacc: 5,941; lex: 1,541; perl: 1,382; cpp: 1,339; sed: 285; pascal: 175; awk: 26
file content (29 lines) | stat: -rw-r--r-- 740 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
From: David Kimdon <dwhedon@gordian.com>
Date: Wed, 19 Sep 2001 16:52:42 -0700
Subject: Specify which filename is causing an error if the filename is a
 directory

Bug-Debian: https://bugs.debian.org/45832
Forwarded: not-needed
---
 bfd/opncls.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/bfd/opncls.c b/bfd/opncls.c
index 788b034..1f67ac0 100644
--- a/bfd/opncls.c
+++ b/bfd/opncls.c
@@ -150,6 +150,13 @@ bfd_openr (const char *filename, const char *target)
 {
   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)