Skip to content

Commit

Permalink
Stop program crashing after an illegal argument is passed. It doesn't…
Browse files Browse the repository at this point in the history
… check properly for arguments though.
  • Loading branch information
mikebrady committed Sep 28, 2014
1 parent 53f166a commit 0385889
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions shairport.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,6 @@ int parse_options(int argc, char **argv) {
long_options, NULL)) > 0) {
switch (opt) {
// Note -- Version, Kill, Pause and Help done separately
default:
case 't':
config.timeout = atoi(optarg);
break;
Expand Down Expand Up @@ -265,9 +264,16 @@ int parse_options(int argc, char **argv) {
case 'w':
config.cmd_blocking = 1;
break;
case 'm':
case 'm':
config.mdns_name = optarg;
break;
case '?':
/* getopt_long already printed an error message. */
exit(1);
break; // unnecessary
default:
die("Unexpected option character.");
break; //unnecessary
}
}
return optind;
Expand Down

0 comments on commit 0385889

Please sign in to comment.