moriyoshi Tue, 19 Jul 2011 18:00:16 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=313442
Log:
- Buffers are local to the blocks where they belong.
Changed paths:
U php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
U php/php-src/trunk/sapi/cli/php_cli_server.c
Modified: php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c
===================================================================
--- php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19
17:47:34 UTC (rev 313441)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-07-19
18:00:16 UTC (rev 313442)
@@ -2048,6 +2048,7 @@
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 @@
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 @@
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) {
Modified: php/php-src/trunk/sapi/cli/php_cli_server.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 17:47:34 UTC (rev
313441)
+++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-07-19 18:00:16 UTC (rev
313442)
@@ -2048,6 +2048,7 @@
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 @@
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 @@
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) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php