From d1e57ceb69a008d2f68a9339fa16f833f8a0d8c2 Mon Sep 17 00:00:00 2001 From: guy Date: Sat, 21 Feb 2004 02:15:07 +0000 Subject: Add routines that can be called from dissectors to report file open and read errors; there are separate implementations for Ethereal (pops up an alert box) and Tethereal (prints an error message). Use those routines in the ASN.1 dissector. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@10152 f5534014-38df-0310-8fa8-9805f1628bb7 --- plugins/asn1/packet-asn1.c | 7 ++++--- plugins/plugin_api_list.c | 7 ++++++- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/asn1/packet-asn1.c b/plugins/asn1/packet-asn1.c index ab581d2584..ef1c503210 100644 --- a/plugins/asn1/packet-asn1.c +++ b/plugins/asn1/packet-asn1.c @@ -3,7 +3,7 @@ * * Copyright (c) 2003 by Matthijs Melchior * - * $Id: packet-asn1.c,v 1.18 2004/02/20 22:14:12 guy Exp $ + * $Id: packet-asn1.c,v 1.19 2004/02/21 02:15:07 guy Exp $ * * A plugin for: * @@ -83,6 +83,7 @@ #include #include #include "asn1.h" +#include "report_err.h" #include "simple_dialog.h" #include "plugins/plugin_api_defs.h" @@ -2594,7 +2595,7 @@ read_asn1_type_table(char *filename) && strcmp(filename, old_default_asn1_filename) != 0 #endif ) || errno != ENOENT) - g_warning("error opening %s, %s", filename, strerror(errno)); + report_open_failure(filename, errno, FALSE); return; } fstat(fileno(f), &stat); @@ -2608,7 +2609,7 @@ read_asn1_type_table(char *filename) data = g_malloc(size); if (fread(data, size, 1, f) < 1) { - g_warning("error reading %s, %s", filename, strerror(errno)); + report_read_failure(filename, errno); } fclose(f); diff --git a/plugins/plugin_api_list.c b/plugins/plugin_api_list.c index 04cf89caa2..a82ba8ee44 100644 --- a/plugins/plugin_api_list.c +++ b/plugins/plugin_api_list.c @@ -1,7 +1,7 @@ /* plugin_api_list.c * Used to generate various included files for plugin API * - * $Id: plugin_api_list.c,v 1.27 2004/02/16 18:31:40 sahlberg Exp $ + * $Id: plugin_api_list.c,v 1.28 2004/02/21 02:15:06 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -39,6 +39,7 @@ #include "asn1.h" #include "xdlc.h" #include "epan/except.h" +#include "report_err.h" gint check_col(column_info*, gint); void col_clear(column_info*, gint); @@ -407,3 +408,7 @@ int dissect_xdlc_control(tvbuff_t *tvb, int offset, packet_info *pinfo, protocol_t *find_protocol_by_id(int n); guint tvb_strsize(tvbuff_t *tvb, gint offset); + +void report_open_failure(const char *filename, int err, gboolean for_writing); + +void report_read_failure(const char *filename, int err); -- cgit v1.2.3