NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
lib/46360: putenv incompatibility
>Number: 46360
>Category: lib
>Synopsis: putenv incompatibility
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: lib-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Apr 20 17:00:00 +0000 2012
>Originator: YAMAMOTO Takashi
>Release: NetBSD current
>Organization:
>Environment:
>Description:
some binaries built on netbsd-5 doesn't work correctly on current
due to the putenv incompatibility.
eg. the following is a snippet from erlang. HAVE_COPYING_PUTENV is
detected by a configure script and is set for netbsd-5.
it's unsafe for current because putenv makes 'str' a part of
environment.
static void
set_env(char *key, char *value)
{
#ifdef __WIN32__
if (!SetEnvironmentVariable((LPCTSTR) key, (LPCTSTR) value))
error("SetEnvironmentVariable(\"%s\", \"%s\") failed!", key, value);
#else
size_t size = strlen(key) + 1 + strlen(value) + 1;
char *str = emalloc(size);
sprintf(str, "%s=%s", key, value);
if (putenv(str) != 0)
error("putenv(\"%s\") failed!", str);
#ifdef HAVE_COPYING_PUTENV
efree(str);
#endif
#endif
}
>How-To-Repeat:
>Fix:
version putenv?
>Unformatted:
Home |
Main Index |
Thread Index |
Old Index