Cage: exit when there is no application passed

This regression was introduced in 667667505a
due to wrongfully handling optind.
This commit is contained in:
Jente Hidskes 2019-02-26 18:56:23 +01:00
parent c2226da89b
commit 848929c88c
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA

8
cage.c
View file

@ -84,11 +84,13 @@ handle_signal(int signal, void *data)
static void static void
usage(FILE *file, const char *cage) usage(FILE *file, const char *cage)
{ {
fprintf(file, "Usage: %s APPLICATION\n" fprintf(file, "Usage: %s [OPTIONS] [--] APPLICATION\n"
"\n" "\n"
" -d\t Don't draw client side decorations, when possible\n" " -d\t Don't draw client side decorations, when possible\n"
" -D\t Turn on damage tracking debugging\n" " -D\t Turn on damage tracking debugging\n"
" -h\t Display this help message\n", " -h\t Display this help message\n"
"\n"
" Use -- when you want to pass arguments to APPLICATION\n",
cage); cage);
} }
@ -113,7 +115,7 @@ parse_args(struct cg_server *server, int argc, char *argv[])
} }
} }
if (optind == 0) { if (optind >= argc) {
usage(stderr, argv[0]); usage(stderr, argv[0]);
return false; return false;
} }