+1 for applying this patch.

and attached is yet another fix as my suggestion.
(a bit dirty, and not tested enough).

Moriyoshi


"Sara Golemon" <[EMAIL PROTECTED]> wrote:

> I THINK the patch below will fix critical bug #20887, but it's late and
> I've had a long day so I havn't begun to make sure it'll work properly in
> any circumstance, could anyone else have a look and try it out?
> 
> See my note in Bug #20887 for an explanation of what my theory about the
> problem is.
> 
> -Pollita
> 
> Index: main/php_ini.c
> ===================================================================
> RCS file: /repository/php4/main/php_ini.c,v
> retrieving revision 1.106
> diff -u -r1.106 php_ini.c
> --- main/php_ini.c      12 Nov 2002 20:56:47 -0000      1.106
> +++ main/php_ini.c      12 Dec 2002 06:49:50 -0000
> @@ -298,7 +298,9 @@
>                         char *separator_location =
> strrchr(binary_location, DEFAULT_SLASH);
> 
>                         if (separator_location) {
> -                               *(separator_location+1) = 0;
> +                               separator_location[0] = '\0';
> +                       } else {
> +                               binary_location[0] = '\0';
>                         }
>                         if (*php_ini_search_path) {
>                                 strcat(php_ini_search_path, paths_separator);
> 
> 
> 
> 
> -- 
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
Index: main/php_ini.c
===================================================================
RCS file: /repository/php4/main/php_ini.c,v
retrieving revision 1.106
diff -u -r1.106 php_ini.c
--- main/php_ini.c      12 Nov 2002 20:56:47 -0000      1.106
+++ main/php_ini.c      12 Dec 2002 07:52:04 -0000
@@ -287,11 +287,21 @@
                        efree(binary_location);
                        binary_location = NULL;
                }
+#elif defined(__linux__)
+               binary_location = (char *) emalloc(MAXPATHLEN);
+               binary_location = realpath("/proc/self/exe", binary_location);
+#elif defined(__svr4__)
+               binary_location = (char *) emalloc(MAXPATHLEN);
+               binary_location = realpath("/proc/self/object/a.out", binary_location);
+#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+               binary_location = (char *) emalloc(MAXPATHLEN);
+               binary_location = realpath("/proc/curproc/file", binary_location);
 #else
+               binary_location = NULL;
                if (sapi_module.executable_location) {
-                       binary_location = estrdup(sapi_module.executable_location);
-               } else {
-                       binary_location = NULL;
+                       if (sapi_module.executable_location[0] == DEFAULT_SLASH) {
+                               binary_location = 
+estrdup(sapi_module.executable_location);
+                       }
                }
 #endif
                if (binary_location) {
-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to