diff options
author | gad <gad@FreeBSD.org> | 2012-04-30 00:54:10 +0000 |
---|---|---|
committer | gad <gad@FreeBSD.org> | 2012-04-30 00:54:10 +0000 |
commit | 5fb190b2b7edf0bf9cabd4a770e52a9d17b292ba (patch) | |
tree | 1913092efc3e591f68f043034ea8973cb9921e58 | |
parent | cbb800d0c5a725eb5247d0f72378034e69a095d8 (diff) | |
download | FreeBSD-src-5fb190b2b7edf0bf9cabd4a770e52a9d17b292ba.zip FreeBSD-src-5fb190b2b7edf0bf9cabd4a770e52a9d17b292ba.tar.gz |
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
-rw-r--r-- | usr.sbin/lpr/lpc/cmds.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c index 71aaa1a..e9cd994 100644 --- a/usr.sbin/lpr/lpc/cmds.c +++ b/usr.sbin/lpr/lpc/cmds.c @@ -163,6 +163,14 @@ generic(void (*specificrtn)(struct printer *_pp), int cmdopts, 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 */ |