summaryrefslogtreecommitdiff
path: root/ext/standard/link.c
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-11-15 16:34:16 +0000
committerIlia Alshanetsky <iliaa@php.net>2002-11-15 16:34:16 +0000
commit8193641d2d52c73ede1c0c389372d6087b7d06be (patch)
treef03b91fd39e96c14e05e5411ee3560dd4291a039 /ext/standard/link.c
parent7ba0d505af76021881d9f54526755627c066ffd4 (diff)
downloadphp-git-8193641d2d52c73ede1c0c389372d6087b7d06be.tar.gz
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.
Diffstat (limited to 'ext/standard/link.c')
-rw-r--r--ext/standard/link.c8
1 files changed, 8 insertions, 0 deletions
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;