svn commit: r234824 - head/usr.sbin/lpr/lpc

Garance A Drosehn gad at FreeBSD.org
Mon Apr 30 00:54:11 UTC 2012


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 */


More information about the svn-src-all mailing list