tools/record: de-duplicate an error message

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2021-03-26 08:37:30 +10:00
parent 0828fdcea0
commit 8b822a84c4

View file

@ -2782,17 +2782,17 @@ main(int argc, char **argv)
ctx.outfile = safe_strdup(output_arg);
if (output_arg == NULL && (all || ndevices > 1)) {
fprintf(stderr,
"Recording multiple devices requires an output file\n");
rc = EXIT_INVALID_USAGE;
goto out;
}
if (all) {
char **devices; /* NULL-terminated */
char **d;
if (output_arg == NULL) {
fprintf(stderr,
"Option --all requires an output file\n");
rc = EXIT_INVALID_USAGE;
goto out;
}
devices = all_devices();
d = devices;
@ -2806,13 +2806,6 @@ main(int argc, char **argv)
strv_free(devices);
} else if (ndevices > 1) {
if (ndevices > 1 && output_arg == NULL) {
fprintf(stderr,
"Recording multiple devices requires an output file\n");
rc = EXIT_INVALID_USAGE;
goto out;
}
for (int i = ndevices; i > 0; i -= 1) {
char *devnode = safe_strdup(argv[optind + i - 1]);