fix inadvertent introduction of extern object stx
[musl] / src / misc / setrlimit.c
index 8a1b8cc..7a66ab2 100644 (file)
@@ -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);