summaryrefslogtreecommitdiff
path: root/util.c
diff options
context:
space:
mode:
authorAndy Dougherty <doughera@lafayette.edu>2014-07-25 13:55:32 -0400
committerAndy Dougherty <doughera@lafayette.edu>2014-07-25 16:08:51 -0400
commit235c1d5fb08d2f9bf82de88220390de5210ac392 (patch)
tree853c890f69d5d4784ccfa1a4b2279c11edb36a62 /util.c
parentecd78e215c9b4ab3f3ab71b30e76bbead372a84e (diff)
downloadperl-235c1d5fb08d2f9bf82de88220390de5210ac392.tar.gz
Only use setenv() on Solaris if it is available.
This is a followup to 07ad9e0e19891ec129e1a78e40a66ca19b51302d. util.c:Perl_my_setenv() unconditionally used setenv() if #defined(__sun). Solaris 8 had neither setenv() nor unsetenv(), so it failed. Configure does not currently check for setenv(), but the check for unsetenv() is sufficient here since Solaris 9 and later have both.
Diffstat (limited to 'util.c')
-rw-r--r--util.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/util.c b/util.c
index 1f9a5b3f00..98b121f9e4 100644
--- a/util.c
+++ b/util.c
@@ -2072,7 +2072,11 @@ Perl_my_setenv(pTHX_ const char *nam, const char *val)
my_setenv_format(environ[i], nam, nlen, val, vlen);
} else {
# endif
-# if defined(__CYGWIN__)|| defined(__SYMBIAN32__) || defined(__riscos__) || defined(__sun)
+ /* This next branch should only be called #if defined(HAS_SETENV), but
+ Configure doesn't test for that yet. For Solaris, setenv() and unsetenv()
+ were introduced in Solaris 9, so testing for HAS UNSETENV is sufficient.
+ */
+# if defined(__CYGWIN__)|| defined(__SYMBIAN32__) || defined(__riscos__) || (defined(__sun) && defined(HAS_UNSETENV))
# if defined(HAS_UNSETENV)
if (val == NULL) {
(void)unsetenv(nam);