Skip to content

Commit 7505322

Browse files
author
Moriyoshi Koizumi
committed
- Buffers are local to the blocks where they belong.
1 parent 8e42748 commit 7505322

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

sapi/cli/php_cli_server.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2048,6 +2048,7 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
20482048
extern const opt_struct OPTIONS[];
20492049
const char *document_root = NULL;
20502050
const char *router = NULL;
2051+
char document_root_buf[MAXPATHLEN];
20512052

20522053
while ((c = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2))!=-1) {
20532054
switch (c) {
@@ -2062,7 +2063,6 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
20622063

20632064
if (document_root) {
20642065
struct stat sb;
2065-
char resolved_path[MAXPATHLEN];
20662066

20672067
if (stat(document_root, &sb)) {
20682068
fprintf(stderr, "Directory %s does not exist.\n", document_root);
@@ -2072,19 +2072,18 @@ int do_cli_server(int argc, char **argv TSRMLS_DC) /* {{{ */
20722072
fprintf(stderr, "%s is not a directory.\n", document_root);
20732073
return 1;
20742074
}
2075-
if (VCWD_REALPATH(document_root, resolved_path)) {
2076-
document_root = resolved_path;
2075+
if (VCWD_REALPATH(document_root, document_root_buf)) {
2076+
document_root = document_root_buf;
20772077
}
20782078
} else {
2079-
char path[MAXPATHLEN];
20802079
char *ret = NULL;
20812080

20822081
#if HAVE_GETCWD
2083-
ret = VCWD_GETCWD(path, MAXPATHLEN);
2082+
ret = VCWD_GETCWD(document_root_buf, MAXPATHLEN);
20842083
#elif HAVE_GETWD
2085-
ret = VCWD_GETWD(path);
2084+
ret = VCWD_GETWD(document_root_buf);
20862085
#endif
2087-
document_root = ret ? path : ".";
2086+
document_root = ret ? document_root_buf: ".";
20882087
}
20892088

20902089
if (argc > php_optind) {

0 commit comments

Comments
 (0)