forked from Archive/PX4-Autopilot
Merge branch 'getopt_fixes' into sdlog2_opt
This commit is contained in:
commit
544de3c9f0
|
@ -670,6 +670,10 @@ int sdlog2_thread_main(int argc, char *argv[])
|
|||
argv += 2;
|
||||
int ch;
|
||||
|
||||
/* don't exit from getopt loop to leave getopt global variables in consistent state,
|
||||
* set error flag instead */
|
||||
bool err_flag = false;
|
||||
|
||||
while ((ch = getopt(argc, argv, "r:b:eat")) != EOF) {
|
||||
switch (ch) {
|
||||
case 'r': {
|
||||
|
@ -716,13 +720,20 @@ int sdlog2_thread_main(int argc, char *argv[])
|
|||
} else {
|
||||
warnx("unknown option character `\\x%x'", optopt);
|
||||
}
|
||||
err_flag = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
sdlog2_usage("unrecognized flag");
|
||||
errx(1, "exiting");
|
||||
warnx("unrecognized flag");
|
||||
err_flag = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (err_flag) {
|
||||
sdlog2_usage(NULL);
|
||||
}
|
||||
|
||||
gps_time = 0;
|
||||
|
||||
/* create log root dir */
|
||||
|
|
Loading…
Reference in New Issue