summaryrefslogtreecommitdiff
path: root/ext/posix
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2000-10-05 18:26:54 +0000
committerAndi Gutmans <andi@php.net>2000-10-05 18:26:54 +0000
commitfb2c23645bf06fb2ac7141160eb1a48b4dc49be3 (patch)
treebb189dc29d452b6bc109d0efc9f4efb68dcbe008 /ext/posix
parent5ab813e1b621d249b13dd5445e024037c1bf6087 (diff)
downloadphp-git-fb2c23645bf06fb2ac7141160eb1a48b4dc49be3.tar.gz
- Clean-up original code and add to NEWS.
Diffstat (limited to 'ext/posix')
-rw-r--r--ext/posix/posix.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/ext/posix/posix.c b/ext/posix/posix.c
index 7cb17cf8db..0eba167dab 100644
--- a/ext/posix/posix.c
+++ b/ext/posix/posix.c
@@ -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;
}