New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infinite output from lpstat -l -p when printer instances are defined #2073

Closed
michaelrsweet opened this Issue Nov 1, 2006 · 2 comments

Comments

Projects
None yet
1 participant
@michaelrsweet
Collaborator

michaelrsweet commented Nov 1, 2006

Version: 1.2.5
CUPS.org User: splite

A loop variable is reused in the middle of the loop, causing infinite output from 'lpstat -l -p' when printer instances are defined. (Same bug exists in 1.2.4, but I didn't go back further than that.) A patch is attached.

@michaelrsweet

This comment has been minimized.

Collaborator

michaelrsweet commented Nov 2, 2006

CUPS.org User: mike

Thanks, committed a slightly different patch (changed the inner loops to use "j") to accomplish the same thing.

@michaelrsweet

This comment has been minimized.

Collaborator

michaelrsweet commented Nov 2, 2006

"cups-1.2.0-lpstat.patch":

--- /var/tmp/cups-1.2.5/systemv/lpstat.c 2006-09-05 16:45:47.000000000 -0400
+++ systemv/lpstat.c 2006-11-01 12:50:36.000000000 -0500
@@ -1695,7 +1695,8 @@
cups_dest_t dests, / I - User-defined destinations /
int long_status) /
I - Show long status? */
{

  • int i; /* Looping var */

  • int i, /* Looping var */

  •   j;          /* Looping var */
    

    ipp_t request, / IPP Request /
    *response, /
    IPP Response /
    *jobs; /
    IPP Get Jobs response */
    @@ -2102,8 +2103,8 @@
    _cupsLangPuts(stdout, _("\tDefault port settings:\n"));
    }

  •    for (i = 0; i < num_dests; i ++)
    
  • if (!strcasecmp(printer, dests[i].name) && dests[i].instance)
    
  •    for (j = 0; j < num_dests; j ++)
    
  • if (!strcasecmp(printer, dests[j].name) && dests[j].instance)
    

    {
    switch (pstate)
    {
    @@ -2111,20 +2112,20 @@
    _cupsLangPrintf(stdout,
    _("printer %s/%s is idle. "
    "enabled since %s\n"),

  •             printer, dests[i].instance,
    
  •             printer, dests[j].instance,
              printer_state_time);
      break;
      case IPP_PRINTER_PROCESSING :
      _cupsLangPrintf(stdout,
                      _("printer %s/%s now printing %s-%d.  "
                "enabled since %s\n"),
    
  •             printer, dests[i].instance, printer, jobid,
    
  •             printer, dests[j].instance, printer, jobid,
              printer_state_time);
      break;
      case IPP_PRINTER_STOPPED :
      _cupsLangPrintf(stdout,
                      _("printer %s/%s disabled since %s -\n"),
    
  •             printer, dests[i].instance,
    
  •             printer, dests[j].instance,
              printer_state_time);
      break;
    }
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment