sbsiglist: check for owner and type arguments

..rather than segfaulting.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-08-21 18:40:34 +08:00
parent 541beab7ce
commit 030d5ef321

View file

@ -242,6 +242,18 @@ int main(int argc, char **argv)
ctx->infilename = argv[optind]; ctx->infilename = argv[optind];
if (!type_str) {
fprintf(stderr, "No type specified\n");
usage();
return EXIT_FAILURE;
}
if (!type_str) {
fprintf(stderr, "No owner specified\n");
usage();
return EXIT_FAILURE;
}
ctx->type = parse_type(type_str); ctx->type = parse_type(type_str);
if (!ctx->type) { if (!ctx->type) {
fprintf(stderr, "Invalid type '%s'\n", type_str); fprintf(stderr, "Invalid type '%s'\n", type_str);