]> granicus.if.org Git - sudo/commitdiff
Do not set a resource limit to zero when we are unable to fetch a
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Jul 2012 14:10:23 +0000 (10:10 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Jul 2012 14:10:23 +0000 (10:10 -0400)
value from /etc/security/limits.

--HG--
branch : 1.7

aix.c

diff --git a/aix.c b/aix.c
index 873896e22c77f5b6e19b0cd535245d3cf3c2bbee..eaac89426a5179d6838c80f886cc602d20bc4133 100644 (file)
--- a/aix.c
+++ b/aix.c
@@ -106,9 +106,10 @@ aix_setlimits(user)
            else
                rlim.rlim_cur = rlim.rlim_max;  /* soft not specd, use hard */
        } else {
-           /* No hard limit set, try soft limit. */
-           if (aix_getlimit(user, aix_limits[n].soft, &val) == 0)
-               rlim.rlim_cur = val == -1 ? RLIM64_INFINITY : val * aix_limits[n].factor;
+           /* No hard limit set, try soft limit, if it exists. */
+           if (aix_getlimit(user, aix_limits[n].soft, &val) == -1)
+               continue;
+           rlim.rlim_cur = val == -1 ? RLIM64_INFINITY : val * aix_limits[n].factor;
 
            /* Set hard limit per AIX /etc/security/limits documentation. */
            switch (aix_limits[n].resource) {