Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Apr 2012 00:54:10 +0000 (UTC)
From:      Garance A Drosehn <gad@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r234824 - head/usr.sbin/lpr/lpc
Message-ID:  <201204300054.q3U0sAND040516@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201204300054.q3U0sAND040516>