]> 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:03 +0000 (10:10 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 6 Jul 2012 14:10:03 +0000 (10:10 -0400)
value from /etc/security/limits.

common/aix.c

index bd20b2672466251502a9dfdcb7ca9820b28c5cf2..2af2694f92b31365a14603a3c76ad01187bb7ec0 100644 (file)
@@ -108,9 +108,10 @@ aix_setlimits(char *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) {