Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/ksh CID 1225077: check getrlimit return



details:   https://anonhg.NetBSD.org/src/rev/c3067715f571
branches:  trunk
changeset: 338044:c3067715f571
user:      christos <christos%NetBSD.org@localhost>
date:      Sat May 09 13:22:37 2015 +0000

description:
CID 1225077: check getrlimit return

diffstat:

 bin/ksh/c_ulimit.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (30 lines):

diff -r 753ac501fa34 -r c3067715f571 bin/ksh/c_ulimit.c
--- a/bin/ksh/c_ulimit.c        Sat May 09 13:19:22 2015 +0000
+++ b/bin/ksh/c_ulimit.c        Sat May 09 13:22:37 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $   */
+/*     $NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $   */
 
 /*
        ulimit -- handle "ulimit" builtin
@@ -20,7 +20,7 @@
 #include <sys/cdefs.h>
 
 #ifndef lint
-__RCSID("$NetBSD: c_ulimit.c,v 1.10 2012/06/09 02:51:50 christos Exp $");
+__RCSID("$NetBSD: c_ulimit.c,v 1.11 2015/05/09 13:22:37 christos Exp $");
 #endif
 
 
@@ -203,8 +203,9 @@
                for (l = limits; l->name; l++) {
 #ifdef HAVE_SETRLIMIT
                        if (l->which == RLIMIT) {
-                               getrlimit(l->gcmd, &limit);
-                               if (how & SOFT)
+                               if (getrlimit(l->gcmd, &limit) == -1)
+                                       val = RLIM_INFINITY;
+                               else if (how & SOFT)
                                        val = limit.rlim_cur;
                                else if (how & HARD)
                                        val = limit.rlim_max;



Home | Main Index | Thread Index | Old Index