This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] better error output from ar when given a directory


On Saturday 21 October 2006 20:10, Mike Frysinger wrote:
> updated/tweaked patch against latest cvs is attached

erm that one lacked the ChangeLog ...
-mike

Attachment: pgp00000.pgp
Description: PGP signature

2006-10-21  David Kimdon <dwhedon@gordian.com>

	* opncls.c (bfd_fopen): Return failure if filename is a directory.

--- bfd/opncls.c
+++ bfd/opncls.c
@@ -182,6 +182,15 @@ bfd_fopen (const char *filename, const c
 {
   bfd *nbfd;
   const bfd_target *target_vec;
+  struct stat s;
+
+  if ((fd != -1 && fstat (fd, &s) == 0) ||
+      (fd == -1 && 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)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]