]> granicus.if.org Git - php/commitdiff
- Buffers are local to the blocks where they belong.
authorMoriyoshi Koizumi <moriyoshi@php.net>
Tue, 19 Jul 2011 18:00:16 +0000 (18:00 +0000)
committerMoriyoshi Koizumi <moriyoshi@php.net>
Tue, 19 Jul 2011 18:00:16 +0000 (18:00 +0000)
sapi/cli/php_cli_server.c

index c9a26ae8f1d822e4db6095c5c91cc2eac43e7260..f02f2520e4ce6b7585fcb55247ac98568ad87e40 100644 (file)
@@ -2048,6 +2048,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
        extern const opt_struct OPTIONS[];
        const char *document_root = NULL;
        const char *router = NULL;
+       char document_root_buf[MAXPATHLEN];
 
        while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2))!=-1) {
                switch (c) {
@@ -2062,7 +2063,6 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
 
        if (document_root) {
                struct stat sb;
-               char resolved_path[MAXPATHLEN];
 
                if (stat(document_root, &sb)) {
                        fprintf(stderr, "Directory %s does not exist.\n", document_root);
@@ -2072,19 +2072,18 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
                        fprintf(stderr, "%s is not a directory.\n", document_root);
                        return 1;
                }
-               if (VCWD_REALPATH(document_root, resolved_path)) {
-                       document_root = resolved_path;
+               if (VCWD_REALPATH(document_root, document_root_buf)) {
+                       document_root = document_root_buf;
                }
        } else {
-               char path[MAXPATHLEN];
                char *ret = NULL;
 
 #if HAVE_GETCWD
-               ret = VCWD_GETCWD(path, MAXPATHLEN);
+               ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN);
 #elif HAVE_GETWD
-               ret = VCWD_GETWD(path);
+               ret = VCWD_GETWD(document_root_buf);
 #endif
-               document_root = ret ? path : ".";
+               document_root = ret ? document_root_buf: ".";
        }
 
        if (argc > php_optind) {