This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
gold patch committed: Check that options are valid before using them
- From: Ian Lance Taylor <iant at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 19 Mar 2009 12:04:12 -0700
- Subject: gold patch committed: Check that options are valid before using them
In my recent patch to set the close-on-exec flags for descriptors, I
forgot to check that the options are valid before checking whether there
are any plugins. I committed this patch to fix that oversight.
Ian
2009-03-19 Ian Lance Taylor <iant@google.com>
* descriptors.cc (Descriptors::open): Check that the options are
valid before using them.
Index: descriptors.cc
===================================================================
RCS file: /cvs/src/src/gold/descriptors.cc,v
retrieving revision 1.5
diff -u -u -p -r1.5 descriptors.cc
--- descriptors.cc 17 Mar 2009 17:09:44 -0000 1.5
+++ descriptors.cc 19 Mar 2009 19:02:33 -0000
@@ -130,7 +130,9 @@ Descriptors::open(int descriptor, const
// header file but not supported by the kernel.
// Unfortunately there doesn't seem to be any obvious way to
// detect that, as unknown flags passed to open are ignored.
- if (O_CLOEXEC == 0 && parameters->options().has_plugins())
+ if (O_CLOEXEC == 0
+ && parameters->options_valid()
+ && parameters->options().has_plugins())
fcntl(new_descriptor, F_SETFD, FD_CLOEXEC);
{