This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc 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: [RFC] Make getenv O(1)


On 10/14/2013 07:28 PM, OndÅej BÃlka wrote:

In general it's impossible to use anything but linear search because
the application can modify environ[] directly (although it's
questionable whether this is permissible by the standard)

Linear search applies only when environment variable is not present.
When it is present then getting its index in environ and checking that
it matches should be O(1).

Couldn't an earlier entry shadow the entry at the index?

I think we should aim for a totally different API that also fixes the races/memory leaks instead of tweaking the existing implementation. Unfortunately, the "secure" API in C11 doesn't address our issues.

--
Florian Weimer / Red Hat Product Security Team


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