From 8e26c226ac169de177e0f649827638e9a6be6c04 Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Wed, 13 Dec 2017 00:10:25 +0000 Subject: [PATCH] _better_file_error directory. (#45832) Gbp-Pq: Name 006_better_file_error.patch --- bfd/opncls.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bfd/opncls.c b/bfd/opncls.c index fa5498685..3a828254f 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) -- 2.30.2