# HG changeset patch # User Bruno Haible # Date 1295805490 -3600 # Node ID 8e261eb86ba2f1224b71d7bb7bc2b82ab1a28f3f # Parent d1d75dad4a650676d5bc177784d3194b67a8f389 get-rusage-as: Fix bug. * lib/get-rusage-as.c (get_rusage_as_via_setrlimit): Restore the original limit when aborting the first loop. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +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. diff --git a/lib/get-rusage-as.c b/lib/get-rusage-as.c --- a/lib/get-rusage-as.c +++ b/lib/get-rusage-as.c @@ -182,7 +182,7 @@ if (getrlimit (RLIMIT_AS, &orig_limit) < 0) { result = 0; - goto done; + goto done2; } if (orig_limit.rlim_max != RLIM_INFINITY @@ -192,7 +192,7 @@ So bail out. */ { result = 0; - goto done; + goto done2; } { @@ -223,7 +223,7 @@ { /* 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 @@ 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