Author: gad
Date: Mon Apr 30 00:54:10 2012
New Revision: 234824
URL: http://svn.freebsd.org/changeset/base/234824

Log:
  Catch the user-error when no queue name was specified on an
  lpc-command which supports '-msg' (e.g.: setstatus).  Print
  out a helpful error message instead hitting a seg-fault.
  
  MFC after:    3 weeks

Modified:
  head/usr.sbin/lpr/lpc/cmds.c

Modified: head/usr.sbin/lpr/lpc/cmds.c
==============================================================================
--- head/usr.sbin/lpr/lpc/cmds.c        Sun Apr 29 22:29:48 2012        
(r234823)
+++ head/usr.sbin/lpr/lpc/cmds.c        Mon Apr 30 00:54:10 2012        
(r234824)
@@ -163,6 +163,14 @@ generic(void (*specificrtn)(struct print
                                break;
                        }
                }
+               if (argc < 1) {
+                       printf("error: No printer name(s) specified before"
+                           " '-msg'.\n");
+                       printf("usage: %s  {all | printer ...}",
+                           generic_cmdname);
+                       printf(" [-msg <text> ...]\n");
+                       return;
+               }
        }
 
        /* call initialization routine, if there is one for this cmd */
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to