]> granicus.if.org Git - php/commitdiff
MFH: Fix expand_filepath when including relative files, ideally you should test your...
authorScott MacVicar <scottmac@php.net>
Tue, 9 Oct 2007 10:06:34 +0000 (10:06 +0000)
committerScott MacVicar <scottmac@php.net>
Tue, 9 Oct 2007 10:06:34 +0000 (10:06 +0000)
main/fopen_wrappers.c

index 70b07ef8b2dbaab5d6413cac74ae6ebaae475c1f..e0122ff152958f561bad6273ccec08a8ee61ad67 100644 (file)
@@ -621,8 +621,10 @@ PHPAPI char *expand_filepath(const char *filepath, char *real_path TSRMLS_DC)
                                copy_len = strlen(filepath) > MAXPATHLEN - 1 ? MAXPATHLEN - 1 : strlen(filepath);
                                real_path = estrndup(filepath, copy_len);
                                return real_path;
+                       } else {
+                               cwd[0] = '\0';
                        }
-               } else {
+               } else if (!result) {
                        cwd[0] = '\0';
                }
        }