diff -up hplip-2.7.12/prnt/backend/hp.c.media-empty hplip-2.7.12/prnt/backend/hp.c --- hplip-2.7.12/prnt/backend/hp.c.media-empty 2007-11-29 00:17:27.000000000 +0000 +++ hplip-2.7.12/prnt/backend/hp.c 2008-01-18 14:37:11.000000000 +0000 @@ -517,10 +517,12 @@ bugout: } /* Check printer status, if in an error state, loop until error condition is cleared. */ +/* XXX What if it is immediately replaced by a different error condition? XXX */ static int loop_test(HPMUD_DEVICE dd, HPMUD_CHANNEL cd, struct pjl_attributes *pa, const char *uri, const char *job) { - int retry=0, status; + int status; const char *pstate; + const char *emitted_state_reason = NULL; while (1) { @@ -529,27 +531,26 @@ static int loop_test(HPMUD_DEVICE dd, HP if (strcmp(pstate, "none")==0) { - if (retry) + if (emitted_state_reason) { /* Clear error. */ device_event(uri, job, VSTATUS_PRNT, "event", 0); fputs("INFO: Printing...\n", stderr); - fprintf(stderr, "STATE: -%s\n", pstate); - retry=0; + fprintf(stderr, "STATE: -%s\n", emitted_state_reason); } break; /* no error, done */ } - if (!retry) + if (!emitted_state_reason) { /* Display error. */ device_event(uri, job, status, "error", RETRY_TIMEOUT); - fprintf(stderr, "STATE: +%s\n", pstate); + emitted_state_reason = pstate; + fprintf(stderr, "STATE: +%s\n", emitted_state_reason); } BUG("ERROR: %d %s; will retry in %d seconds...\n", status, pstate, RETRY_TIMEOUT); sleep(RETRY_TIMEOUT); - retry = 1; } return 0;