cvs: php4 /ext/standard link.c
| From: | Ilia Alshanetsky | Date: | Fri, 15 Nov 2002 16:34:17 +0000 |
| Subject: | cvs: php4 /ext/standard link.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-16296@lists.php.net to get a copy of this message | ||
iliaa Fri Nov 15 11:34:17 2002 EDT
Modified files:
/php4/ext/standard link.c
Log:
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.
Index: php4/ext/standard/link.c
diff -u php4/ext/standard/link.c:1.43 php4/ext/standard/link.c:1.44
--- php4/ext/standard/link.c:1.43 Thu Nov 14 11:20:23 2002
+++ php4/ext/standard/link.c Fri Nov 15 11:34:16 2002
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: link.c,v 1.43 2002/11/14 16:20:23 iliaa Exp $ */
+/* $Id: link.c,v 1.44 2002/11/15 16:34:16 iliaa Exp $ */
#include "php.h"
#include "php_filestat.h"
@@ -146,7 +146,11 @@
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 @@
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;