]> granicus.if.org Git - php/commitdiff
- Clean-up original code and add to NEWS.
authorAndi Gutmans <andi@php.net>
Thu, 5 Oct 2000 18:26:54 +0000 (18:26 +0000)
committerAndi Gutmans <andi@php.net>
Thu, 5 Oct 2000 18:26:54 +0000 (18:26 +0000)
NEWS
ext/posix/posix.c

diff --git a/NEWS b/NEWS
index b90560906d09856406bbbf5f91c9965f8709ed9b..5fef30ac3a21aae7fd263aa481db6348db6e65a3 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,7 @@ PHP 4.0                                                                    NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 
 05 Oct 2000, Version 4.0.3
+- Fixed crash in the POSIX getrlimit() function (alex@zend.com)
 - Fixed dirname() under certain conditions (Andi)
 - Add --with-imap-ssl to support SSL'ized imap library in RH7 and others
   (Rasmus)
index 7cb17cf8dba3917b2ba039fb9455213b9b94d068..0eba167dab94a84094301fe69b2ed6b60bbd5305 100644 (file)
@@ -833,6 +833,9 @@ PHP_FUNCTION(posix_getpwuid)
 
 
 #ifdef HAVE_GETRLIMIT
+
+#define UNLIMITED_STRING "unlimited"
+
 static int posix_addlimit(int limit, char *name, pval *return_value) {
        int result;
        struct rlimit rl;
@@ -848,15 +851,17 @@ static int posix_addlimit(int limit, char *name, pval *return_value) {
                return FAILURE;
        }
 
-       if (rl.rlim_cur == RLIM_INFINITY)
-               add_assoc_string(return_value,soft,"unlimited", 1);
-       else
-               add_assoc_long(return_value,soft,rl.rlim_cur);
+       if (rl.rlim_cur == RLIM_INFINITY) {
+               add_assoc_stringl(return_value, soft, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
+       } else {
+               add_assoc_long(return_value, soft, rl.rlim_cur);
+       }
 
-       if (rl.rlim_max == RLIM_INFINITY)
-               add_assoc_string(return_value,hard,"unlimited", 1);
-       else
-               add_assoc_long(return_value,hard,rl.rlim_max);
+       if (rl.rlim_max == RLIM_INFINITY) {
+               add_assoc_stringl(return_value, hard, UNLIMITED_STRING, sizeof(UNLIMITED_STRING)-1, 1);
+       } else {
+               add_assoc_long(return_value, hard, rl.rlim_max);
+       }
 
        return SUCCESS;
 }