From 5f1b5daf6bae66123c58cb6697374091a19191b8 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 8 Jul 2004 07:45:46 +0000 Subject: A read can return WTAP_ERR_UNSUPPORTED_ENCAP if the encapsulation type is per-packet and the packet has an encapsulation type we don't know about, so handle it on reads as well as errors - show an error message noting that we had a packet with a network type we don't know about, and show the extra info returned for that error giving details. It shouldn't return WTAP_ERR_UNSUPPORTED, however, so just give the "wtap_strerror()" error for that case. svn path=/trunk/; revision=11340 --- file.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index f48fc5c95f..c7a0708df8 100644 --- a/file.c +++ b/file.c @@ -1,7 +1,7 @@ /* file.c * File I/O routines * - * $Id: file.c,v 1.386 2004/06/30 06:58:56 guy Exp $ + * $Id: file.c,v 1.387 2004/07/08 07:45:46 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs @@ -488,7 +488,10 @@ cf_read(capture_file *cf) switch (err) { case WTAP_ERR_UNSUPPORTED_ENCAP: - errmsg = "The capture file is for a network type that Ethereal doesn't support."; + snprintf(errmsg_errno, sizeof(errmsg_errno), + "The capture file has a packet with a network type that Ethereal doesn't support.\n(%s)", + err_info); + errmsg = errmsg_errno; break; case WTAP_ERR_CANT_READ: @@ -2983,8 +2986,12 @@ cf_read_error_message(int err, gchar *err_info) switch (err) { - case WTAP_ERR_UNSUPPORTED: case WTAP_ERR_UNSUPPORTED_ENCAP: + snprintf(errmsg_errno, sizeof(errmsg_errno), + "The file \"%%s\" has a packet with a network type that Ethereal doesn't support.\n(%s)", + err_info); + break; + case WTAP_ERR_BAD_RECORD: snprintf(errmsg_errno, sizeof(errmsg_errno), "An error occurred while reading from the file \"%%s\": %s.\n(%s)", -- cgit v1.2.3