From: Ilia Alshanetsky Date: Fri, 15 Nov 2002 16:34:16 +0000 (+0000) Subject: With ZTS on, we need to resolve the full paths before making symlinks. X-Git-Tag: RELEASE_1_0b2~206 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8193641d2d52c73ede1c0c389372d6087b7d06be;p=php With ZTS on, we need to resolve the full paths before making symlinks. 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. --- diff --git a/ext/standard/link.c b/ext/standard/link.c index 0d1aabfdcd..0730c4f9b6 100644 --- a/ext/standard/link.c +++ b/ext/standard/link.c @@ -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;