This is the mail archive of the
glibc-bugs@sourceware.org
mailing list for the glibc project.
[Bug libc/15607] Add threadsafe version of getenv()
- From: "neleai at seznam dot cz" <sourceware-bugzilla at sourceware dot org>
- To: glibc-bugs at sourceware dot org
- Date: Mon, 14 Oct 2013 18:51:50 +0000
- Subject: [Bug libc/15607] Add threadsafe version of getenv()
- Auto-submitted: auto-generated
- References: <bug-15607-131 at http dot sourceware dot org/bugzilla/>
https://sourceware.org/bugzilla/show_bug.cgi?id=15607
Ondrej Bilka <neleai at seznam dot cz> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |neleai at seznam dot cz
--- Comment #7 from Ondrej Bilka <neleai at seznam dot cz> ---
A setenv does locking, you could try to send a patch that adds locking to
getenv.
> Note that, if others do end up deeming it desirable to change glibc, the
> appropriate change would be having setenv do the above-described atomic
> replacement and simply leak the old environment.
> This would be fully safe with no locking.
A atomic part is already done. For leaking part you have problem with current
code:
/* We allocated this space; we can extend it. */
new_environ = (char **) realloc (last_environ,
(size + 2) * sizeof (char *));
which you would need to change to standard doubling of sizes.
--
You are receiving this mail because:
You are on the CC list for the bug.