Skip to content
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

'lpq -P' crashes #94

Closed
michaelrsweet opened this issue May 14, 2003 · 3 comments
Closed

'lpq -P' crashes #94

michaelrsweet opened this issue May 14, 2003 · 3 comments
Milestone

Comments

@michaelrsweet
Copy link
Collaborator

Version: 1.1.19rc5
CUPS.org User: twaugh.redhat

'lpq -P' crashes.

@michaelrsweet
Copy link
Collaborator Author

CUPS.org User: mike

Fixed in CVS using attached patch (which doesn't use a goto! :)

@michaelrsweet
Copy link
Collaborator Author

"cups-1.1.19rc5-optparse.patch":

--- cups-1.1.19rc5/berkeley/lpq.c.optparse 2003-05-14 13:00:51.000000000 +0100
+++ cups-1.1.19rc5/berkeley/lpq.c 2003-05-14 13:03:14.000000000 +0100
@@ -128,6 +128,8 @@
else
{
i ++;

  •     if (i == argc)
    
  •            goto syntax;
      dest = argv[i];
    }
    

@@ -154,7 +156,7 @@
longstatus = 1;
break;

  • default :
  • default : syntax:
    fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
    httpClose(http);
    cupsFreeDests(num_dests, dests);

@michaelrsweet
Copy link
Collaborator Author

"str94.patch":

Index: lpq.c

RCS file: /development/cvs/cups/berkeley/lpq.c,v
retrieving revision 1.24
diff -u -r1.24 lpq.c
--- lpq.c 2003/01/15 04:15:45 1.24
+++ lpq.c 2003/05/14 18:32:30
@@ -26,6 +26,7 @@

  • main() - Parse options and commands.
  • show_jobs() - Show jobs.
  • show_printer() - Show printer status.
  • * usage() - Show program usage.
    */

/*
@@ -51,6 +52,7 @@
static int show_jobs(http_t *, const char *, const char *, const int,
const int);
static void show_printer(http_t *, const char *);
+static void usage(void);

/*
@@ -128,6 +130,15 @@
else
{
i ++;
+

  •     if (i >= argc)
    
  •     {
    
  •   httpClose(http);
    
  •   cupsFreeDests(num_dests, dests);
    
  •       usage();
    
  •     }
    
    • dest = argv[i];
      }

@@ -155,10 +166,11 @@
break;

default :
  •   fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
    httpClose(http);
    
  •        cupsFreeDests(num_dests, dests);
    
  •   return (1);
    
  •   cupsFreeDests(num_dests, dests);
    
  •   usage();
    
  •   break;
    
    }
    }
    else if (isdigit(argv[i][0]))
    @@ -541,6 +553,18 @@
    else
    fprintf(stderr, "lpq: get-printer-attributes failed: %s\n",
    ippErrorString(cupsLastError()));
    +}
    +
    +
    +/*
  • * 'usage()' - Show program usage.
  • */
    +
    +static void
    +usage(void)
    +{
  • fputs("Usage: lpq [-P dest] [-l] [+interval]\n", stderr);
  • exit(1);
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant