88,89d87 < const int MAX_ATTEMPTS = 10; < int attempt = 0; 105,118c103,111 < while(TRUE) { < stk500_send(pgm, buf, 2); < stk500_recv(pgm, resp, 1); < if (resp[0] == Resp_STK_INSYNC){ < break; < } < attempt++; < fprintf(stderr, < "%s: stk500_getsync() attempt %d of %d: not in sync: resp=0x%02x\n", < progname, attempt, MAX_ATTEMPTS, resp[0]); < if (attempt == MAX_ATTEMPTS) { < stk500_drain(pgm, 0); < return -1; < } --- > stk500_send(pgm, buf, 2); > if (stk500_recv(pgm, resp, 1) < 0) > return -1; > if (resp[0] != Resp_STK_INSYNC) { > fprintf(stderr, > "%s: stk500_getsync(): not in sync: resp=0x%02x\n", > progname, resp[0]); > stk500_drain(pgm, 0); > return -1;