This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: fix locking bug on FileRead::Open()
- From: csilvers at google dot com (Craig Silverstein)
- To: binutils at sourceware dot org
- Date: Wed, 20 Aug 2008 17:32:46 -0700 (PDT)
- Subject: PATCH: fix locking bug on FileRead::Open()
I just committed this patch, which affects commands like these:
./ld --version-script=/no/such/file
./ld -b binary /no/such/file
Before, they would trigger an assert, because even though the file
wasn't found, it was acquiring a lock that never got released. The
patch below fixes that.
Approved offline by Ian Taylor.
craig
--cut here--
2008-08-20 Craig Silverstein <csilvers@google.com>
* fileread.cc (File_read::open): Do not lock the file unless it
was successfully opened.
--- fileread.cc.~1.42.~ 2008-08-19 21:45:39.000000000 -0700
+++ fileread.cc 2008-08-20 16:14:34.472018000 -0700
@@ -121,9 +121,9 @@
this->size_ = s.st_size;
gold_debug(DEBUG_FILES, "Attempt to open %s succeeded",
this->name_.c_str());
- }
- this->token_.add_writer(task);
+ this->token_.add_writer(task);
+ }
return this->descriptor_ >= 0;
}