forked from osmocom/wireshark
Fix error checking for --inject-secrets argument.
If there was no secrets type specified, say so. Otherwise, if the secrets type wasn't valid, report the correct string as the invalid secrets type. Change-Id: I3cd7d419ce3577fc176a256069456c5b49e81608 Reviewed-on: https://code.wireshark.org/review/31667 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
parent
079fbb8b82
commit
d3eb10c2c1
14
editcap.c
14
editcap.c
|
@ -1102,13 +1102,17 @@ main(int argc, char *argv[])
|
|||
goto clean_exit;
|
||||
}
|
||||
gchar **splitted = g_strsplit(optarg, ",", 2);
|
||||
if (splitted[0]) {
|
||||
if (splitted[0] && splitted[0][0] != '\0') {
|
||||
secrets_type_id = lookup_secrets_type(splitted[0]);
|
||||
secrets_filename = splitted[1];
|
||||
}
|
||||
|
||||
if (secrets_type_id == 0) {
|
||||
fprintf(stderr, "editcap: \"%s\" isn't a valid secrets type\n", secrets_filename);
|
||||
fprintf(stderr, "editcap: \"%s\" isn't a valid secrets type\n", splitted[0]);
|
||||
g_strfreev(splitted);
|
||||
ret = INVALID_OPTION;
|
||||
goto clean_exit;
|
||||
}
|
||||
secrets_filename = splitted[1];
|
||||
} else {
|
||||
fprintf(stderr, "editcap: no secrets type was specified for --inject-secrets\n");
|
||||
g_strfreev(splitted);
|
||||
ret = INVALID_OPTION;
|
||||
goto clean_exit;
|
||||
|
|
Loading…
Reference in New Issue