On Tue, Jun 20, 2017 at 08:49:59PM +0200, Ævar Arnfjörð Bjarmason wrote:
> If I understand you correctly this on top:
>
>     diff --git a/usage.c b/usage.c
>     index 1c198d4882..f6d5af2bb4 100644
>     --- a/usage.c
>     +++ b/usage.c
>     @@ -46,7 +46,19 @@ static int die_is_recursing_builtin(void)
>       static int dying;
>       static int recursion_limit = 1024;
>
>     - return dying++ > recursion_limit;
>     + dying++;
>     +
>     + if (!dying) {

This will never trigger as dying was incremented two lines
before. But I think it's already handled by the dying <
recursion_limit case so we can just omit it.

>     +         /* ok, normal */
>     +         return 0;
>     + } else if (dying < recursion_limit) {
>     +         /* only show the warning once */
>     +         if (dying == 1)
>     +                 warning("die() called many times. Recursion error or 
> racy threaded death!");
>     +         return 0; /* don't bail yet */
>     + } else {
>     +         return 1;
>     + }
>      }

Maybe restructure it like this:

    dying++
    if (dying > recursion_limit)
        return 1;
    if (dying == 1)
        warning();
    return 0;

Btw. is there a reason why recursion_limit is a static variable
and not a constant/define?

Regards
Simon
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9

Reply via email to