aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt_core
diff options
context:
space:
mode:
authorDario Lombardo <lomato@gmail.com>2017-07-23 23:11:42 +0200
committerAnders Broman <a.broman58@gmail.com>2017-07-25 04:55:44 +0000
commit17f72a0b2273e8c45296711d2454997e74e2734c (patch)
tree4063f65dc55b0327545232bbe86626d22f9ed0f6 /randpkt_core
parent1e584b8a13cd6514f2ec5d117d055f3270c944d5 (diff)
randpkt: choose a random type if the empty string has been selected as type.
Fixes a bug when calling randpktdump without the dialog. Reproducer: Open wireshark Double click on randpktdump Stop the capture No packets have been generated. Change-Id: I43d1d3c02afbb44f88620a696a7d25aa4e45889a Reviewed-on: https://code.wireshark.org/review/22775 Petri-Dish: Dario Lombardo <lomato@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'randpkt_core')
-rw-r--r--randpkt_core/randpkt_core.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c
index 20900c6279..f35077b7b4 100644
--- a/randpkt_core/randpkt_core.c
+++ b/randpkt_core/randpkt_core.c
@@ -698,8 +698,8 @@ int randpkt_parse_type(char *string)
int num_entries = array_length(examples);
int i;
- /* Called with NULL, choose a random packet */
- if (!string) {
+ /* If called with NULL, or empty string, choose a random packet */
+ if (!string || !g_strcmp0(string, "")) {
return examples[g_random_int_range(0, num_entries)].produceable_type;
}
@@ -710,7 +710,7 @@ int randpkt_parse_type(char *string)
}
/* Complain */
- fprintf(stderr, "randpkt: Type %s not known.\n", string);
+ g_error("randpkt: Type %s not known.\n", string);
return -1;
}