From b3ceeca337ffafe66e74d430ad93f1d5517218e2 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sun, 23 Jan 2011 18:58:10 +0100 Subject: [PATCH] get-rusage-as: Fix bug. * lib/get-rusage-as.c (get_rusage_as_via_setrlimit): Restore the original limit when aborting the first loop. --- ChangeLog | 6 ++++++ lib/get-rusage-as.c | 9 +++++---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 88513d513..5425c6616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-01-23 Bruno Haible + get-rusage-as: Fix bug. + * lib/get-rusage-as.c (get_rusage_as_via_setrlimit): Restore the + original limit when aborting the first loop. + +2011-01-23 Bruno Haible + wctype: Ensure valid C syntax. * m4/wctype_h.m4 (gl_WCTYPE_H): Invoke gl_CHECK_NEXT_HEADERS unconditionally, instead of gl_NEXT_HEADERS conditionally. diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c index 7ab1c9315..0250ce589 100644 --- a/lib/get-rusage-as.c +++ b/lib/get-rusage-as.c @@ -182,7 +182,7 @@ get_rusage_as_via_setrlimit (void) if (getrlimit (RLIMIT_AS, &orig_limit) < 0) { result = 0; - goto done; + goto done2; } if (orig_limit.rlim_max != RLIM_INFINITY @@ -192,7 +192,7 @@ get_rusage_as_via_setrlimit (void) So bail out. */ { result = 0; - goto done; + goto done2; } { @@ -223,7 +223,7 @@ get_rusage_as_via_setrlimit (void) { /* try_next could not be increased. */ result = low_bound; - goto done; + goto done1; } try_limit.rlim_max = orig_limit.rlim_max; @@ -311,11 +311,12 @@ get_rusage_as_via_setrlimit (void) result = low_bound; } + done1: /* Restore the original rlim_cur value. */ if (setrlimit (RLIMIT_AS, &orig_limit) < 0) abort (); - done: + done2: # if !HAVE_MAP_ANONYMOUS close (fd); # endif -- 2.11.0