]> granicus.if.org Git - php/commitdiff
Eliminated unnecessary getcwd() syscall
authorDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 10:42:31 +0000 (10:42 +0000)
committerDmitry Stogov <dmitry@php.net>
Fri, 17 Mar 2006 10:42:31 +0000 (10:42 +0000)
main/fopen_wrappers.c

index 3cf8b77c890cfcbc5d908f01bb29b63a5df833f4..750bf3dba85f44dae18e2594ccbffeed304cd010 100644 (file)
@@ -518,9 +518,13 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC)
        char cwd[MAXPATHLEN];
        char *result;
 
-       result = VCWD_GETCWD(cwd, MAXPATHLEN);  
-       if (!result) {
+       if (IS_ABSOLUTE_PATH(filepath, strlen(filepath))) {
                cwd[0] = '\0';
+       } else{
+               result = VCWD_GETCWD(cwd, MAXPATHLEN);
+               if (!result) {
+                       cwd[0] = '\0';
+               }
        }
 
        new_state.cwd = strdup(cwd);