[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-cvs
Subject:    [PHP-CVS] =?utf-8?q?svn:_/php/php-src/_branches/PHP=5F5=5F4/sapi/cli/php=5Fcli=5Fserver.c_trunk/sapi
From:       David_Soria_Parra <dsp () php ! net>
Date:       2011-06-29 23:29:01
Message-ID: svn-dsp-1309390141-312643-550238598 () svn ! php ! net
[Download RAW message or body]

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 = ".";
 	}



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic