Skip to content

Commit

Permalink
Cage: exit when there is no application passed
Browse files Browse the repository at this point in the history
This regression was introduced in 6676675
due to wrongfully handling optind.
  • Loading branch information
Hjdskes committed Feb 26, 2019
1 parent c2226da commit 848929c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions cage.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ handle_signal(int signal, void *data)
static void
usage(FILE *file, const char *cage)
{
fprintf(file, "Usage: %s APPLICATION\n"
fprintf(file, "Usage: %s [OPTIONS] [--] APPLICATION\n"
"\n"
" -d\t Don't draw client side decorations, when possible\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);
}

Expand All @@ -113,7 +115,7 @@ parse_args(struct cg_server *server, int argc, char *argv[])
}
}

if (optind == 0) {
if (optind >= argc) {
usage(stderr, argv[0]);
return false;
}
Expand Down

0 comments on commit 848929c

Please sign in to comment.