summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-02-15 05:42:27 -0500
committerRich Felker <dalias@aerifal.cx>2011-02-15 05:42:27 -0500
commitf7eb91e7952553dc24a734030a6c78f8dc6ed455 (patch)
tree15e212fa4214ba919d02f733c5b266ad1afb71b6 /src
parent13a026bd79f0024d57b7edf8305d625599d10810 (diff)
downloadmusl-f7eb91e7952553dc24a734030a6c78f8dc6ed455.tar.gz
musl-f7eb91e7952553dc24a734030a6c78f8dc6ed455.tar.bz2
musl-f7eb91e7952553dc24a734030a6c78f8dc6ed455.tar.xz
musl-f7eb91e7952553dc24a734030a6c78f8dc6ed455.zip
fix getrlimit handling on 32-bit systems, and ease porting to 64-bit
Diffstat (limited to 'src')
-rw-r--r--src/misc/getrlimit.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/misc/getrlimit.c b/src/misc/getrlimit.c
index db25943b..84a659d4 100644
--- a/src/misc/getrlimit.c
+++ b/src/misc/getrlimit.c
@@ -5,10 +5,10 @@
int getrlimit(int resource, struct rlimit *rlim)
{
long k_rlim[2];
- if (syscall2(__NR_ugetrlimit, resource, (long)k_rlim) < 0)
+ if (syscall2(__NR_getrlimit, resource, (long)k_rlim) < 0)
return -1;
- rlim->rlim_cur = k_rlim[0];
- rlim->rlim_max = k_rlim[1];
+ rlim->rlim_cur = k_rlim[0] == -1 ? -1 : (unsigned long)k_rlim[0];
+ rlim->rlim_max = k_rlim[1] == -1 ? -1 : (unsigned long)k_rlim[1];
return 0;
}