From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22762 invoked by alias); 14 Oct 2013 18:51:54 -0000 Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org Received: (qmail 22696 invoked by uid 48); 14 Oct 2013 18:51:52 -0000 From: "neleai at seznam dot cz" To: glibc-bugs@sourceware.org Subject: [Bug libc/15607] Add threadsafe version of getenv() Date: Mon, 14 Oct 2013 18:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: neleai at seznam dot cz X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-10/txt/msg00158.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=15607 Ondrej Bilka changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |neleai at seznam dot cz --- Comment #7 from Ondrej Bilka --- 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.