@@ -483,7 +483,7 @@ CWD_API realpath_cache_bucket** realpath_cache_get_buckets(void)
483
483
#undef LINK_MAX
484
484
#define LINK_MAX 32
485
485
486
- static size_t tsrm_realpath_r (char * path , size_t start , size_t len , int * ll , time_t * t , int use_realpath , int is_dir , int * link_is_dir ) /* {{{ */
486
+ static size_t tsrm_realpath_r (char * path , size_t start , size_t len , int * ll , time_t * t , int use_realpath , bool is_dir , int * link_is_dir ) /* {{{ */
487
487
{
488
488
size_t i , j ;
489
489
int directory = 0 , save ;
@@ -996,7 +996,7 @@ static size_t tsrm_realpath_r(char *path, size_t start, size_t len, int *ll, tim
996
996
/* }}} */
997
997
998
998
/* Resolve path relatively to state and put the real path into state */
999
- /* returns 0 for ok, 1 for error */
999
+ /* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */
1000
1000
CWD_API int virtual_file_ex (cwd_state * state , const char * path , verify_path_func verify_path , int use_realpath ) /* {{{ */
1001
1001
{
1002
1002
size_t path_length = strlen (path );
@@ -1005,7 +1005,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
1005
1005
int ll = 0 ;
1006
1006
time_t t ;
1007
1007
int ret ;
1008
- int add_slash ;
1008
+ bool add_slash ;
1009
1009
void * tmp ;
1010
1010
1011
1011
if (!path_length || path_length >= MAXPATHLEN - 1 ) {
@@ -1178,12 +1178,14 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
1178
1178
}
1179
1179
/* }}} */
1180
1180
1181
- CWD_API int virtual_chdir (const char * path ) /* {{{ */
1181
+ CWD_API ZEND_RESULT_CODE virtual_chdir (const char * path ) /* {{{ */
1182
1182
{
1183
- return virtual_file_ex (& CWDG (cwd ), path , php_is_dir_ok , CWD_REALPATH )? -1 : 0 ;
1183
+ return virtual_file_ex (& CWDG (cwd ), path , php_is_dir_ok , CWD_REALPATH ) ? FAILURE : SUCCESS ;
1184
1184
}
1185
1185
/* }}} */
1186
1186
1187
+
1188
+ /* returns 0 for ok, 1 for empty string, -1 on error */
1187
1189
CWD_API int virtual_chdir_file (const char * path , int (* p_chdir )(const char * path )) /* {{{ */
1188
1190
{
1189
1191
size_t length = strlen (path );
@@ -1255,6 +1257,7 @@ CWD_API char *virtual_realpath(const char *path, char *real_path) /* {{{ */
1255
1257
}
1256
1258
/* }}} */
1257
1259
1260
+ /* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */
1258
1261
CWD_API int virtual_filepath_ex (const char * path , char * * filepath , verify_path_func verify_path ) /* {{{ */
1259
1262
{
1260
1263
cwd_state new_state ;
@@ -1270,6 +1273,7 @@ CWD_API int virtual_filepath_ex(const char *path, char **filepath, verify_path_f
1270
1273
}
1271
1274
/* }}} */
1272
1275
1276
+ /* returns 0 for ok, 1 for error, -1 if (path_length >= MAXPATHLEN-1) */
1273
1277
CWD_API int virtual_filepath (const char * path , char * * filepath ) /* {{{ */
1274
1278
{
1275
1279
return virtual_filepath_ex (path , filepath , php_is_file_ok );
0 commit comments