aboutsummaryrefslogtreecommitdiffstats
path: root/randpkt_core/randpkt_core.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-04-20 14:07:06 -0700
committerGuy Harris <guy@alum.mit.edu>2017-04-20 21:07:35 +0000
commit804d3f62454895c1560a690728b859f68ee35bf6 (patch)
tree1a1597cdb4f3fadc9187e2243bcae372ca680a4c /randpkt_core/randpkt_core.c
parent64ec2b2e5ed590a6f1a3d22c8b24a6e70420d1f9 (diff)
Use cfile_write_failure_message() in the randpkt code.
Change-Id: I32ef7ff85f854782e5dd02c3e7f12436a120bc13 Reviewed-on: https://code.wireshark.org/review/21259 Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'randpkt_core/randpkt_core.c')
-rw-r--r--randpkt_core/randpkt_core.c64
1 files changed, 6 insertions, 58 deletions
diff --git a/randpkt_core/randpkt_core.c b/randpkt_core/randpkt_core.c
index d9f4a1b1f2..10afdf9e17 100644
--- a/randpkt_core/randpkt_core.c
+++ b/randpkt_core/randpkt_core.c
@@ -29,9 +29,11 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
-#include "wsutil/file_util.h"
+#include <wsutil/file_util.h>
#include <wiretap/wtap_opttypes.h>
+#include "ui/failure_message.h"
+
#define array_length(x) (sizeof x / sizeof x[0])
#define INVALID_LEN 1
@@ -623,63 +625,9 @@ void randpkt_loop(randpkt_example* example, guint64 produce_count)
}
if (!wtap_dump(example->dump, pkthdr, buffer, &err, &err_info)) {
- fprintf(stderr, "randpkt: Error writing to %s: %s\n",
- example->filename, wtap_strerror(err));
- switch (err) {
-
- case WTAP_ERR_UNWRITABLE_ENCAP:
- /*
- * This is a problem with the particular
- * frame we're writing and the file type
- * and subtype we're writing; note that,
- * and report the file type/subtype.
- */
- fprintf(stderr,
- "Frame has a network type that can't be saved in a \"%s\" file.\n",
- wtap_file_type_subtype_short_string(WTAP_FILE_TYPE_SUBTYPE_PCAP));
- break;
-
- case WTAP_ERR_PACKET_TOO_LARGE:
- /*
- * This is a problem with the particular
- * frame we're writing and the file type
- * and subtype we're writing; note that,
- * and report the file type/subtype.
- */
- fprintf(stderr,
- "Frame is too large for a \"%s\" file.\n",
- wtap_file_type_subtype_short_string(WTAP_FILE_TYPE_SUBTYPE_PCAP));
- break;
-
- case WTAP_ERR_UNWRITABLE_REC_TYPE:
- /*
- * This is a problem with the particular
- * record we're writing and the file type
- * and subtype we're writing; note that,
- * and report the file type/subtype.
- */
- fprintf(stderr,
- "Record has a record type that can't be saved in a \"%s\" file.\n",
- wtap_file_type_subtype_short_string(WTAP_FILE_TYPE_SUBTYPE_PCAP));
- break;
-
- case WTAP_ERR_UNWRITABLE_REC_DATA:
- /*
- * This is a problem with the particular
- * record we're writing and the file type
- * and subtype we're writing; note that,
- * and report the file type/subtype.
- */
- fprintf(stderr,
- "Record has data that can't be saved in a \"%s\" file.\n(%s)\n",
- wtap_file_type_subtype_short_string(WTAP_FILE_TYPE_SUBTYPE_PCAP),
- err_info != NULL ? err_info : "no information supplied");
- g_free(err_info);
- break;
-
- default:
- break;
- }
+ cfile_write_failure_message("randpkt", NULL,
+ example->filename, err, err_info, 0,
+ WTAP_FILE_TYPE_SUBTYPE_PCAP);
}
}