From owner-svn-src-head@FreeBSD.ORG Mon Apr 30 00:54:10 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id EECBF106566C; Mon, 30 Apr 2012 00:54:10 +0000 (UTC) (envelope-from gad@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DAC0D8FC0C; Mon, 30 Apr 2012 00:54:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q3U0sAAs040518; Mon, 30 Apr 2012 00:54:10 GMT (envelope-from gad@svn.freebsd.org) Received: (from gad@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3U0sAND040516; Mon, 30 Apr 2012 00:54:10 GMT (envelope-from gad@svn.freebsd.org) Message-Id: <201204300054.q3U0sAND040516@svn.freebsd.org> From: Garance A Drosehn Date: Mon, 30 Apr 2012 00:54:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r234824 - head/usr.sbin/lpr/lpc X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Apr 2012 00:54:11 -0000 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 ...]\n"); + return; + } } /* call initialization routine, if there is one for this cmd */