FreeBSD >= 700050 has POSIX standard putenv().

PR:		ports/123911
Submitted by:	scf
This commit is contained in:
Alex Dupre 2008-06-09 12:11:33 +00:00
parent 42960df8df
commit 388c8b6c6d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=214543
2 changed files with 16 additions and 26 deletions

View file

@ -1,5 +1,5 @@
--- ext/standard/basic_functions.c.orig 2008-05-02 08:44:06.000000000 +0200
+++ ext/standard/basic_functions.c 2008-05-02 08:54:00.000000000 +0200
--- ext/standard/basic_functions.c.orig 2008-06-09 14:06:40.000000000 +0200
+++ ext/standard/basic_functions.c 2008-06-09 14:08:28.000000000 +0200
@@ -87,6 +87,7 @@
# include <sys/loadavg.h>
#endif
@ -8,26 +8,21 @@
#ifdef HARTMUT_0
#include <getopt.h>
#endif
@@ -3861,9 +3862,7 @@
@@ -3859,7 +3860,7 @@
SetEnvironmentVariable(pe->key, "bugbug");
#endif
putenv(pe->previous_value);
-# if defined(PHP_WIN32)
+# if defined(PHP_WIN32) || __FreeBSD_version < 700050
efree(pe->previous_value);
-# endif
# endif
} else {
# if HAVE_UNSETENV
unsetenv(pe->key);
@@ -4463,12 +4462,8 @@
@@ -4461,7 +4462,7 @@
pe.previous_value = NULL;
for (env = environ; env != NULL && *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
-#if defined(PHP_WIN32)
+#if defined(PHP_WIN32) || __FreeBSD_version < 700050
/* must copy previous value because MSVCRT's putenv can free the string without notice */
pe.previous_value = estrdup(*env);
-#else
- pe.previous_value = *env;
-#endif
break;
}
}
#else

View file

@ -1,5 +1,5 @@
--- ext/standard/basic_functions.c.orig 2008-05-02 08:44:06.000000000 +0200
+++ ext/standard/basic_functions.c 2008-05-02 08:54:00.000000000 +0200
--- ext/standard/basic_functions.c.orig 2008-06-09 14:06:40.000000000 +0200
+++ ext/standard/basic_functions.c 2008-06-09 14:08:28.000000000 +0200
@@ -87,6 +87,7 @@
# include <sys/loadavg.h>
#endif
@ -8,26 +8,21 @@
#ifdef HARTMUT_0
#include <getopt.h>
#endif
@@ -3861,9 +3862,7 @@
@@ -3859,7 +3860,7 @@
SetEnvironmentVariable(pe->key, "bugbug");
#endif
putenv(pe->previous_value);
-# if defined(PHP_WIN32)
+# if defined(PHP_WIN32) || __FreeBSD_version < 700050
efree(pe->previous_value);
-# endif
# endif
} else {
# if HAVE_UNSETENV
unsetenv(pe->key);
@@ -4463,12 +4462,8 @@
@@ -4461,7 +4462,7 @@
pe.previous_value = NULL;
for (env = environ; env != NULL && *env != NULL; env++) {
if (!strncmp(*env, pe.key, pe.key_len) && (*env)[pe.key_len] == '=') { /* found it */
-#if defined(PHP_WIN32)
+#if defined(PHP_WIN32) || __FreeBSD_version < 700050
/* must copy previous value because MSVCRT's putenv can free the string without notice */
pe.previous_value = estrdup(*env);
-#else
- pe.previous_value = *env;
-#endif
break;
}
}
#else