X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fsetrlimit.c;h=7a66ab29756b4a179a8077d7b4f50598b639e9da;hb=4554f155dd23a65fcdfd39f1d5af8af55ba37694;hp=8a1b8cc63d3428cda6654b23742dadbe7f740678;hpb=8258014fd1e34e942a549c88c7e022a00445c352;p=musl diff --git a/src/misc/setrlimit.c b/src/misc/setrlimit.c index 8a1b8cc6..7a66ab29 100644 --- a/src/misc/setrlimit.c +++ b/src/misc/setrlimit.c @@ -6,7 +6,7 @@ #define MIN(a, b) ((a)<(b) ? (a) : (b)) #define FIX(x) do{ if ((x)>=SYSCALL_RLIM_INFINITY) (x)=RLIM_INFINITY; }while(0) -int __setrlimit(int resource, const struct rlimit *rlim) +static int __setrlimit(int resource, const struct rlimit *rlim) { unsigned long k_rlim[2]; struct rlimit tmp; @@ -32,19 +32,19 @@ struct ctx { static void do_setrlimit(void *p) { struct ctx *c = p; - if (c->err) return; + if (c->err>0) return; c->err = -__setrlimit(c->res, c->rlim); } int setrlimit(int resource, const struct rlimit *rlim) { - struct ctx c = { .res = resource, .rlim = rlim }; + struct ctx c = { .res = resource, .rlim = rlim, .err = -1 }; __synccall(do_setrlimit, &c); if (c.err) { - errno = c.err; + if (c.err>0) errno = c.err; return -1; } return 0; } -LFS64(setrlimit); +weak_alias(setrlimit, setrlimit64);