From 6b48551c93e67312ccb39216a14a418d89f8082a Mon Sep 17 00:00:00 2001 From: Moriyoshi Koizumi Date: Tue, 19 Jul 2011 18:00:16 +0000 Subject: - Buffers are local to the blocks where they belong. --- sapi/cli/php_cli_server.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'sapi/cli/php_cli_server.c') diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c index c9a26ae8f1..f02f2520e4 100644 --- a/sapi/cli/php_cli_server.c +++ b/sapi/cli/php_cli_server.c @@ -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) { -- cgit v1.2.1