rasmus                                   Wed, 10 Aug 2011 17:40:56 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=314766

Log:
Use HOST_NAME_MAX constant here instead for the gethostname() func

Changed paths:
    U   php/php-src/branches/PHP_5_3/ext/standard/dns.c
    U   php/php-src/branches/PHP_5_4/ext/standard/dns.c
    U   php/php-src/trunk/ext/standard/dns.c

Modified: php/php-src/branches/PHP_5_3/ext/standard/dns.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/standard/dns.c     2011-08-10 16:43:02 UTC 
(rev 314765)
+++ php/php-src/branches/PHP_5_3/ext/standard/dns.c     2011-08-10 17:40:56 UTC 
(rev 314766)
@@ -66,6 +66,12 @@
 #define MAXHOSTNAMELEN 255
 #endif

+/* For the local hostname obtained via gethostname which is different from the
+   dns-related MAXHOSTNAMELEN constant above */
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
 #include "php_dns.h"

 /* type compat */
@@ -122,7 +128,7 @@
    Get the host name of the current machine */
 PHP_FUNCTION(gethostname)
 {
-       char buf[MAXHOSTNAMELEN];
+       char buf[HOST_NAME_MAX];

        if (zend_parse_parameters_none() == FAILURE) {
                return;

Modified: php/php-src/branches/PHP_5_4/ext/standard/dns.c
===================================================================
--- php/php-src/branches/PHP_5_4/ext/standard/dns.c     2011-08-10 16:43:02 UTC 
(rev 314765)
+++ php/php-src/branches/PHP_5_4/ext/standard/dns.c     2011-08-10 17:40:56 UTC 
(rev 314766)
@@ -66,6 +66,12 @@
 #define MAXHOSTNAMELEN 255
 #endif

+/* For the local hostname obtained via gethostname which is different from the
+   dns-related MAXHOSTNAMELEN constant above */
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
 #include "php_dns.h"

 /* type compat */
@@ -122,7 +128,7 @@
    Get the host name of the current machine */
 PHP_FUNCTION(gethostname)
 {
-       char buf[MAXHOSTNAMELEN];
+       char buf[HOST_NAME_MAX];

        if (zend_parse_parameters_none() == FAILURE) {
                return;

Modified: php/php-src/trunk/ext/standard/dns.c
===================================================================
--- php/php-src/trunk/ext/standard/dns.c        2011-08-10 16:43:02 UTC (rev 
314765)
+++ php/php-src/trunk/ext/standard/dns.c        2011-08-10 17:40:56 UTC (rev 
314766)
@@ -66,6 +66,12 @@
 #define MAXHOSTNAMELEN 255
 #endif

+/* For the local hostname obtained via gethostname which is different from the
+   dns-related MAXHOSTNAMELEN constant above */
+#ifndef HOST_NAME_MAX
+#define HOST_NAME_MAX 255
+#endif
+
 #include "php_dns.h"

 /* type compat */
@@ -122,7 +128,7 @@
    Get the host name of the current machine */
 PHP_FUNCTION(gethostname)
 {
-       char buf[MAXHOSTNAMELEN];
+       char buf[HOST_NAME_MAX];

        if (zend_parse_parameters_none() == FAILURE) {
                return;

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

Reply via email to