Return the target of a symbolic link */
PHP_FUNCTION(readlink)
{
- pval **filename;
+ zval **filename;
char buff[256];
int ret;
}
convert_to_string_ex(filename);
- ret = readlink((*filename)->value.str.val, buff, 255);
+ ret = readlink(Z_STRVAL_PP(filename), buff, 255);
if (ret == -1) {
php_error(E_WARNING, "readlink failed (%s)", strerror(errno));
RETURN_FALSE;
Returns the st_dev field of the UNIX C stat structure describing the link */
PHP_FUNCTION(linkinfo)
{
- pval **filename;
+ zval **filename;
struct stat sb;
int ret;
}
convert_to_string_ex(filename);
- ret = VCWD_LSTAT((*filename)->value.str.val, &sb);
+ ret = VCWD_LSTAT(Z_STRVAL_PP(filename), &sb);
if (ret == -1) {
- php_error(E_WARNING, "LinkInfo failed (%s)", strerror(errno));
+ php_error(E_WARNING, "Linkinfo failed (%s)", strerror(errno));
RETURN_LONG(-1L);
}
+
RETURN_LONG((long) sb.st_dev);
}
/* }}} */
Create a symbolic link */
PHP_FUNCTION(symlink)
{
- pval **topath, **frompath;
+ zval **topath, **frompath;
int ret;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
convert_to_string_ex(topath);
convert_to_string_ex(frompath);
- if (PG(safe_mode) && !php_checkuid((*topath)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
+ if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(topath), NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
RETURN_FALSE;
}
- if (!strncasecmp((*topath)->value.str.val, "http://", 7) || !strncasecmp((*topath)->value.str.val, "ftp://", 6)) {
+
+ if (!strncasecmp(Z_STRVAL_PP(topath), "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) {
php_error(E_WARNING, "Unable to symlink to a URL");
RETURN_FALSE;
}
- ret = symlink((*topath)->value.str.val, (*frompath)->value.str.val);
+ ret = symlink(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
if (ret == -1) {
- php_error(E_WARNING, "SymLink failed (%s)", strerror(errno));
+ php_error(E_WARNING, "Symlink failed (%s)", strerror(errno));
RETURN_FALSE;
}
+
RETURN_TRUE;
}
/* }}} */
Create a hard link */
PHP_FUNCTION(link)
{
- pval **topath, **frompath;
+ zval **topath, **frompath;
int ret;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &topath, &frompath) == FAILURE) {
convert_to_string_ex(topath);
convert_to_string_ex(frompath);
- if (PG(safe_mode) && !php_checkuid((*topath)->value.str.val, NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
+ if (PG(safe_mode) && !php_checkuid(Z_STRVAL_PP(topath), NULL, CHECKUID_CHECK_FILE_AND_DIR)) {
RETURN_FALSE;
}
- if (!strncasecmp((*topath)->value.str.val, "http://", 7) || !strncasecmp((*topath)->value.str.val, "ftp://", 6)) {
+
+ if (!strncasecmp((*topath)->value.str.val, "http://", 7) || !strncasecmp(Z_STRVAL_PP(topath), "ftp://", 6)) {
php_error(E_WARNING, "Unable to link to a URL");
RETURN_FALSE;
}
- ret = link((*topath)->value.str.val, (*frompath)->value.str.val);
+ ret = link(Z_STRVAL_PP(topath), Z_STRVAL_PP(frompath));
if (ret == -1) {
php_error(E_WARNING, "Link failed (%s)", strerror(errno));
RETURN_FALSE;
}
+
RETURN_TRUE;
}
/* }}} */
* tab-width: 4
* c-basic-offset: 4
* End:
- * vim600: sw=4 ts=4 tw=78 fdm=marker
- * vim<600: sw=4 ts=4 tw=78
+ * vim600: noet sw=4 ts=4 tw=78 fdm=marker
+ * vim<600: noet sw=4 ts=4 tw=78
*/