svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c
| From: | David Soria Parra | Date: | Wed, 29 Jun 2011 23:29:01 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_4/sapi/cli/php_cli_server.c trunk/sapi/cli/php_cli_server.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-65377@lists.php.net to get a copy of this message | ||
dsp Wed, 29 Jun 2011 23:29:01 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=312643
Log:
fix #55072 in-built web server needs to check -t option is a directory
Bug: http://bugs.php.net/55072 (unknown)
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-06-29 22:01:55 UTC (rev 312642)
+++ php/php-src/branches/PHP_5_4/sapi/cli/php_cli_server.c 2011-06-29 23:29:01 UTC (rev 312643)
@@ -88,6 +88,10 @@
# define SOCK_EADDRINUSE WSAEADDRINUSE
#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
+#endif
+
#include "ext/standard/file.h" /* for php_set_sock_blocking() :-( */
#include "ext/standard/php_smart_str.h"
#include "ext/standard/html.h"
@@ -2060,6 +2064,10 @@
fprintf(stderr, "Directory or script %s does not exist.\n", document_root);
return 1;
}
+ if (!S_ISDIR(sb.st_mode)) {
+ fprintf(stderr, "%s is not a directory.\n", document_root);
+ return 1;
+ }
} else {
document_root = ".";
}
Modified: php/php-src/trunk/sapi/cli/php_cli_server.c
===================================================================
--- php/php-src/trunk/sapi/cli/php_cli_server.c 2011-06-29 22:01:55 UTC (rev 312642)
+++ php/php-src/trunk/sapi/cli/php_cli_server.c 2011-06-29 23:29:01 UTC (rev 312643)
@@ -88,6 +88,10 @@
# define SOCK_EADDRINUSE WSAEADDRINUSE
#endif
+#ifndef S_ISDIR
+#define S_ISDIR(mode) (((mode)&S_IFMT) == S_IFDIR)
+#endif
+
#include "ext/standard/file.h" /* for php_set_sock_blocking() :-( */
#include "ext/standard/php_smart_str.h"
#include "ext/standard/html.h"
@@ -2060,6 +2064,10 @@
fprintf(stderr, "Directory or script %s does not exist.\n", document_root);
return 1;
}
+ if (!S_ISDIR(sb.st_mode)) {
+ fprintf(stderr, "%s is not a directory.\n", document_root);
+ return 1;
+ }
} else {
document_root = ".";
}