From 4eddcb4c564151d606aef8b3fc32172a6fac5573 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 28 Jul 2015 18:49:23 +0100 Subject: [PATCH] Fix braino in gtkask.c loop conditions. If you're counting up to ms_limit in steps of ms_step, it's silly to add ms_step at the end of the loop body _and_ increment the loop variable by 1 in the loop header. I must have been half asleep. --- unix/gtkask.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/unix/gtkask.c b/unix/gtkask.c index de1bd4b7..bc245723 100644 --- a/unix/gtkask.c +++ b/unix/gtkask.c @@ -176,11 +176,10 @@ static int repeatedly_try_grab(struct askpass_ctx *ctx, try_grab_fn_t fn) const useconds_t ms_step = 1000000/8; /* at 1/8 second intervals */ useconds_t ms; - for (ms = 0; ms < ms_limit; ms++) { + for (ms = 0; ms < ms_limit; ms += ms_step) { if (fn(ctx)) return TRUE; usleep(ms_step); - ms += ms_step; } return FALSE; }