scummvm random work
[patches.git] / binutils-bfd-no-open-dir.patch
CommitLineData
5e993f12 12006-10-21 David Kimdon <dwhedon@gordian.com>
2
3 * opncls.c (bfd_fopen): Return failure if filename is a directory.
4
5--- bfd/opncls.c
6+++ bfd/opncls.c
7@@ -182,6 +182,15 @@ bfd_fopen (const char *filename, const c
8 {
9 bfd *nbfd;
10 const bfd_target *target_vec;
11+ struct stat s;
12+
13+ if ((fd != -1 && fstat (fd, &s) == 0) ||
14+ (fd == -1 && stat (filename, &s) == 0))
15+ if (S_ISDIR(s.st_mode))
16+ {
17+ bfd_set_error (bfd_error_file_not_recognized);
18+ return NULL;
19+ }
20
21 nbfd = _bfd_new_bfd ();
22 if (nbfd == NULL)