aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/alert_box.c17
-rw-r--r--ui/capture.c8
-rw-r--r--ui/failure_message.c16
-rw-r--r--wiretap/file_wrappers.c10
-rw-r--r--wiretap/wtap.c3
-rw-r--r--wiretap/wtap.h3
6 files changed, 54 insertions, 3 deletions
diff --git a/ui/alert_box.c b/ui/alert_box.c
index d387dacb8d..907a04a81a 100644
--- a/ui/alert_box.c
+++ b/ui/alert_box.c
@@ -143,6 +143,14 @@ cfile_open_failure_alert_box(const char *filename, int err, gchar *err_info)
g_free(err_info);
break;
+ case WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED:
+ simple_error_message_box(
+ "The file \"%s\" cannot be decompressed; it is compressed in a way that we don't support.\n"
+ "(%s)", display_basename,
+ err_info != NULL ? err_info : "no information supplied");
+ g_free(err_info);
+ break;
+
default:
simple_error_message_box(
"The file \"%s\" could not be opened: %s.",
@@ -295,6 +303,15 @@ cfile_read_failure_alert_box(const char *filename, int err, gchar *err_info)
g_free(err_info);
break;
+ case WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED:
+ simple_error_message_box(
+ "The %s cannot be decompressed; it is compressed in a way that we don't support.\n"
+ "(%s)",
+ display_name,
+ err_info != NULL ? err_info : "no information supplied");
+ g_free(err_info);
+ break;
+
default:
simple_error_message_box(
"An error occurred while reading the %s: %s.",
diff --git a/ui/capture.c b/ui/capture.c
index 90cc169d9b..cc4b09127e 100644
--- a/ui/capture.c
+++ b/ui/capture.c
@@ -377,6 +377,14 @@ cf_open_error_message(int err, gchar *err_info, gboolean for_writing,
errmsg = errmsg_errno;
break;
+ case WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED:
+ g_snprintf(errmsg_errno, sizeof(errmsg_errno),
+ "We don't support the form of compression used by the compressed file \"%%s\".\n"
+ "(%s)", err_info != NULL ? err_info : "no information supplied");
+ g_free(err_info);
+ errmsg = errmsg_errno;
+ break;
+
default:
g_snprintf(errmsg_errno, sizeof(errmsg_errno),
"The file \"%%s\" could not be %s: %s.",
diff --git a/ui/failure_message.c b/ui/failure_message.c
index 7626562987..93dcf166e1 100644
--- a/ui/failure_message.c
+++ b/ui/failure_message.c
@@ -136,6 +136,14 @@ cfile_open_failure_message(const char *progname, const char *filename,
g_free(err_info);
break;
+ case WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED:
+ cmdarg_err("The %s cannot be decompressed; it is compressed in a way that we don't support."
+ "(%s)",
+ file_description,
+ err_info != NULL ? err_info : "no information supplied");
+ g_free(err_info);
+ break;
+
default:
cmdarg_err("The %s could not be opened: %s.",
file_description,
@@ -266,6 +274,14 @@ cfile_read_failure_message(const char *progname, const char *filename,
g_free(err_info);
break;
+ case WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED:
+ cmdarg_err("The %s cannot be decompressed; it is compressed in a way that we don't support.\n"
+ "(%s)",
+ file_string,
+ err_info != NULL ? err_info : "no information supplied");
+ g_free(err_info);
+ break;
+
default:
cmdarg_err("An error occurred while reading the %s: %s.",
file_string, wtap_strerror(err));
diff --git a/wiretap/file_wrappers.c b/wiretap/file_wrappers.c
index 56cd2711c8..8d5ff51b51 100644
--- a/wiretap/file_wrappers.c
+++ b/wiretap/file_wrappers.c
@@ -574,13 +574,13 @@ gz_head(FILE_T state)
}
/* look for the gzip magic header bytes 31 and 139 */
-#ifdef HAVE_ZLIB
if (state->next_in[0] == 31) {
state->avail_in--;
state->next_in++;
if (state->avail_in == 0 && fill_in_buffer(state) == -1)
return -1;
if (state->avail_in && state->next_in[0] == 139) {
+#ifdef HAVE_ZLIB
guint8 cm;
guint8 flags;
guint16 len;
@@ -662,8 +662,13 @@ gz_head(FILE_T state)
state->fast_seek_cur = cur;
fast_seek_header(state, state->raw_pos - state->avail_in, state->pos, GZIP_AFTER_HEADER);
}
-#endif
+#endif /* Z_BLOCK */
return 0;
+#else /* HAVE_ZLIB */
+ state->err = WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED;
+ state->err_info = "reading gzip-compressed files isn't supported";
+ return -1;
+#endif /* HAVE_ZLIB */
}
else {
/* not a gzip file -- save first byte (31) and fall to raw i/o */
@@ -671,7 +676,6 @@ gz_head(FILE_T state)
state->have = 1;
}
}
-#endif
#ifdef HAVE_LIBXZ
/* { 0xFD, '7', 'z', 'X', 'Z', 0x00 } */
/* FD 37 7A 58 5A 00 */
diff --git a/wiretap/wtap.c b/wiretap/wtap.c
index 9ee5ed8bf1..5b1d6fdf17 100644
--- a/wiretap/wtap.c
+++ b/wiretap/wtap.c
@@ -1096,6 +1096,9 @@ static const char *wtap_errlist[] = {
/* WTAP_ERR_UNWRITABLE_REC_DATA */
"That record can't be written in that format"
+
+ /* WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED */
+ "We don't support decompressing that type of compressed file",
};
#define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0])
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 29f1527d60..13e97829f7 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -2126,6 +2126,9 @@ void wtap_cleanup(void);
#define WTAP_ERR_UNWRITABLE_REC_DATA -25
/** Something in the record data can't be written to that file type */
+#define WTAP_ERR_DECOMPRESSION_NOT_SUPPORTED -26
+ /** We don't support decompressing that type of compressed file */
+
#ifdef __cplusplus
}
#endif /* __cplusplus */