]> granicus.if.org Git - php/commitdiff
With ZTS on, we need to resolve the full paths before making symlinks.
authorIlia Alshanetsky <iliaa@php.net>
Fri, 15 Nov 2002 16:34:16 +0000 (16:34 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Fri, 15 Nov 2002 16:34:16 +0000 (16:34 +0000)
If a chdir() call occurs before the symlink operation, the symlink is
created in the current directory rather then directory we've chdired to
because in ZTS we don't actually chdir but store the new path internally.

For an example of this problem consider the ext/standard/tests/file/001.phpt
test under ZTS.

ext/standard/link.c

index 0d1aabfdcd97ac1826573fb758b3eb352103dbc8..0730c4f9b6127d4a4a042231559d1d3b829bcc17 100644 (file)
@@ -146,7 +146,11 @@ PHP_FUNCTION(symlink)
                RETURN_FALSE;
        }
 
+#ifndef ZTS
        ret = symlink(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
+#else 
+       ret = symlink(dest_p, source_p);
+#endif 
        if (ret == -1) {
                php_error(E_WARNING, "Symlink failed (%s)", strerror(errno));
                RETURN_FALSE;
@@ -197,7 +201,11 @@ PHP_FUNCTION(link)
                RETURN_FALSE;
        }
 
+#ifndef ZTS
        ret = link(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
+#else 
+       ret = link(dest_p, source_p);   
+#endif 
        if (ret == -1) {
                php_error(E_WARNING, "Link failed (%s)", strerror(errno));
                RETURN_FALSE;