diff options
author | Guy Harris <guy@alum.mit.edu> | 2014-10-07 16:18:47 -0700 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2014-10-07 23:19:56 +0000 |
commit | a566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11 (patch) | |
tree | 1730a9b5c9cc7704273e4104a426e6987f9ef9b6 /wiretap | |
parent | 5e0e4fa9e4de39f9402e6472e6b25439f8464c24 (diff) | |
download | wireshark-a566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11.tar.gz wireshark-a566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11.tar.bz2 wireshark-a566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11.zip |
No need for WTAP_ERR_CANT_READ.
Unlike the standard I/O routines, the code we introduced that supports
fast random seeking on gzipped files will always supply some specific
error code for read errors, so we don't need WTAP_ERR_CANT_READ.
Add WTAP_ERR_CANT_WRITE for writing, as we're still using the standard
I/O routines for that. Set errno to WTAP_ERR_CANT_WRITE before calling
fwrite() in wtap_dump_file_write(), so that it's used if fwrite() fails
without setting errno.
Change-Id: I6bf066a6838284a532737aa65fd0c9bb3639ad63
Reviewed-on: https://code.wireshark.org/review/4540
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wiretap')
-rw-r--r-- | wiretap/5views.c | 1 | ||||
-rw-r--r-- | wiretap/aethra.c | 3 | ||||
-rw-r--r-- | wiretap/btsnoop.c | 3 | ||||
-rw-r--r-- | wiretap/eyesdn.c | 2 | ||||
-rw-r--r-- | wiretap/file_access.c | 1 | ||||
-rw-r--r-- | wiretap/i4btrace.c | 2 | ||||
-rw-r--r-- | wiretap/iptrace.c | 3 | ||||
-rw-r--r-- | wiretap/iseries.c | 1 | ||||
-rw-r--r-- | wiretap/lanalyzer.c | 5 | ||||
-rw-r--r-- | wiretap/libpcap.c | 3 | ||||
-rw-r--r-- | wiretap/mp2t.c | 2 | ||||
-rw-r--r-- | wiretap/mpeg.c | 2 | ||||
-rw-r--r-- | wiretap/netmon.c | 6 | ||||
-rw-r--r-- | wiretap/netscaler.c | 1 | ||||
-rw-r--r-- | wiretap/nettl.c | 3 | ||||
-rw-r--r-- | wiretap/network_instruments.c | 1 | ||||
-rw-r--r-- | wiretap/netxray.c | 3 | ||||
-rw-r--r-- | wiretap/ngsniffer.c | 8 | ||||
-rw-r--r-- | wiretap/pcap-common.c | 16 | ||||
-rw-r--r-- | wiretap/pcapng.c | 17 | ||||
-rw-r--r-- | wiretap/radcom.c | 11 | ||||
-rw-r--r-- | wiretap/snoop.c | 6 | ||||
-rw-r--r-- | wiretap/visual.c | 4 | ||||
-rw-r--r-- | wiretap/vwr.c | 1 | ||||
-rw-r--r-- | wiretap/wtap.c | 52 | ||||
-rw-r--r-- | wiretap/wtap.h | 8 |
26 files changed, 56 insertions, 109 deletions
diff --git a/wiretap/5views.c b/wiretap/5views.c index a2f5364283..6e128d4f0e 100644 --- a/wiretap/5views.c +++ b/wiretap/5views.c @@ -115,7 +115,6 @@ int _5views_open(wtap *wth, int *err, gchar **err_info) t_5VW_Capture_Header Capture_Header; int encap = WTAP_ENCAP_UNKNOWN; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &Capture_Header.Info_Header, sizeof(t_5VW_Info_Header), err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) diff --git a/wiretap/aethra.c b/wiretap/aethra.c index 87e5515037..331c6fcfdd 100644 --- a/wiretap/aethra.c +++ b/wiretap/aethra.c @@ -126,7 +126,6 @@ int aethra_open(wtap *wth, int *err, gchar **err_info) aethra_t *aethra; /* Read in the string that should be at the start of a "aethra" file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, hdr.magic, sizeof hdr.magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) @@ -138,7 +137,6 @@ int aethra_open(wtap *wth, int *err, gchar **err_info) return 0; /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, (char *)&hdr + sizeof hdr.magic, sizeof hdr - sizeof hdr.magic, err, err_info)) return -1; @@ -301,7 +299,6 @@ aethra_read_rec_header(wtap *wth, FILE_T fh, struct aethrarec_hdr *hdr, guint32 msecs; /* Read record header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, hdr, sizeof *hdr, err, err_info)) return FALSE; diff --git a/wiretap/btsnoop.c b/wiretap/btsnoop.c index 0e28449b5a..051589e8f3 100644 --- a/wiretap/btsnoop.c +++ b/wiretap/btsnoop.c @@ -88,7 +88,6 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info) int file_encap=WTAP_ENCAP_UNKNOWN; /* Read in the string that should be at the start of a "btsnoop" file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -100,7 +99,6 @@ int btsnoop_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -181,7 +179,6 @@ static gboolean btsnoop_read_record(wtap *wth, FILE_T fh, /* Read record header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &hdr, sizeof hdr, err, err_info)) return FALSE; diff --git a/wiretap/eyesdn.c b/wiretap/eyesdn.c index 0c024e9c76..2c815d62f1 100644 --- a/wiretap/eyesdn.c +++ b/wiretap/eyesdn.c @@ -140,7 +140,6 @@ int eyesdn_open(wtap *wth, int *err, gchar **err_info) char magic[EYESDN_HDR_MAGIC_SIZE]; /* Look for eyesdn header */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -325,7 +324,6 @@ read_eyesdn_rec(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int *err, /* Make sure we have enough room for the packet */ ws_buffer_assure_space(buf, EYESDN_MAX_PACKET_LEN); - errno = WTAP_ERR_CANT_READ; pd = ws_buffer_start_ptr(buf); if (!esc_read(fh, pd, pkt_len, err, err_info)) return FALSE; diff --git a/wiretap/file_access.c b/wiretap/file_access.c index 33640df1d1..b2a05b05fe 100644 --- a/wiretap/file_access.c +++ b/wiretap/file_access.c @@ -2405,6 +2405,7 @@ wtap_dump_file_write(wtap_dumper *wdh, const void *buf, size_t bufsize, int *err } else #endif { + errno = WTAP_ERR_CANT_WRITE; nwritten = fwrite(buf, 1, bufsize, (FILE *)wdh->fh); /* * At least according to the Mac OS X man page, diff --git a/wiretap/i4btrace.c b/wiretap/i4btrace.c index 4f7f241b42..6e9ef001dc 100644 --- a/wiretap/i4btrace.c +++ b/wiretap/i4btrace.c @@ -55,7 +55,6 @@ int i4btrace_open(wtap *wth, int *err, gchar **err_info) i4btrace_t *i4btrace; /* I4B trace files have no magic in the header... Sigh */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof(hdr), err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -142,7 +141,6 @@ i4b_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, i4b_trace_hdr_t hdr; guint32 length; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &hdr, sizeof hdr, err, err_info)) return FALSE; diff --git a/wiretap/iptrace.c b/wiretap/iptrace.c index caa13c0698..317d922215 100644 --- a/wiretap/iptrace.c +++ b/wiretap/iptrace.c @@ -53,7 +53,6 @@ int iptrace_open(wtap *wth, int *err, gchar **err_info) { char name[NAME_SIZE+1]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, name, NAME_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -123,7 +122,6 @@ iptrace_read_rec_1_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, iptrace_1_0_phdr pkt_hdr; guint32 packet_size; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, header, sizeof header, err, err_info)) { /* Read error or EOF */ return FALSE; @@ -299,7 +297,6 @@ iptrace_read_rec_2_0(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, iptrace_2_0_phdr pkt_hdr; guint32 packet_size; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, header, sizeof header, err, err_info)) { /* Read error or EOF */ return FALSE; diff --git a/wiretap/iseries.c b/wiretap/iseries.c index c6d3c36b99..50141f9ab6 100644 --- a/wiretap/iseries.c +++ b/wiretap/iseries.c @@ -209,7 +209,6 @@ iseries_open (wtap * wth, int *err, gchar ** err_info) * Check that file starts with a valid iSeries COMMS TRACE header * by scanning for it in the first line */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes (wth->fh, &magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) diff --git a/wiretap/lanalyzer.c b/wiretap/lanalyzer.c index 70b0403cdd..3c3ba09ad9 100644 --- a/wiretap/lanalyzer.c +++ b/wiretap/lanalyzer.c @@ -289,7 +289,6 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info) struct tm tm; lanalyzer_t *lanalyzer; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &rec_header, LA_RecordHeaderSize, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) @@ -345,7 +344,6 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info) /* Read records until we find the start of packets */ while (1) { - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(wth->fh, &rec_header, LA_RecordHeaderSize, err, err_info)) { if (*err == 0) { @@ -365,7 +363,6 @@ int lanalyzer_open(wtap *wth, int *err, gchar **err_info) switch (record_type) { /* Trace Summary Record */ case RT_Summary: - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, summary, sizeof summary, err, err_info)) return -1; @@ -449,7 +446,6 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, time_t tsecs; /* read the record type and length. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, LE_record_type, 2, err, err_info)) return FALSE; if (!wtap_read_bytes(fh, LE_record_length, 2, err, err_info)) @@ -481,7 +477,6 @@ static gboolean lanalyzer_read_trace_record(wtap *wth, FILE_T fh, record_data_size = record_length - DESCRIPTOR_LEN; /* Read the descriptor data */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, descriptor, DESCRIPTOR_LEN, err, err_info)) return FALSE; diff --git a/wiretap/libpcap.c b/wiretap/libpcap.c index 1b0e2b4571..ecdf8922b3 100644 --- a/wiretap/libpcap.c +++ b/wiretap/libpcap.c @@ -105,7 +105,6 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info) int i; /* Read in the number that should be at the start of a "libpcap" file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -173,7 +172,6 @@ int libpcap_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -741,7 +739,6 @@ static int libpcap_read_header(wtap *wth, FILE_T fh, int *err, gchar **err_info, guint32 temp; libpcap_t *libpcap; - errno = WTAP_ERR_CANT_READ; switch (wth->file_type_subtype) { case WTAP_FILE_TYPE_SUBTYPE_PCAP: diff --git a/wiretap/mp2t.c b/wiretap/mp2t.c index 5337d1d35b..72e566c0d6 100644 --- a/wiretap/mp2t.c +++ b/wiretap/mp2t.c @@ -67,7 +67,6 @@ mp2t_read_packet(mp2t_filetype_t *mp2t, FILE_T fh, gint64 offset, guint64 tmp; ws_buffer_assure_space(buf, MP2T_SIZE); - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, ws_buffer_start_ptr(buf), MP2T_SIZE, err, err_info)) return FALSE; @@ -152,7 +151,6 @@ mp2t_open(wtap *wth, int *err, gchar **err_info) mp2t_filetype_t *mp2t; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, buffer, MP2T_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; diff --git a/wiretap/mpeg.c b/wiretap/mpeg.c index 681e4baa50..00ff23e9bb 100644 --- a/wiretap/mpeg.c +++ b/wiretap/mpeg.c @@ -92,7 +92,6 @@ mpeg_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, * file begins with 0x00 0x00 0x01, it contains PES packets, * otherwise it doesn't)? */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &n, sizeof n, err, err_info)) return FALSE; if (file_seek(fh, -(gint64)(sizeof n), SEEK_CUR, err) == -1) @@ -239,7 +238,6 @@ mpeg_open(wtap *wth, int *err, gchar **err_info) struct _mpeg_magic* m; mpeg_t *mpeg; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic_buf, sizeof magic_buf, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) diff --git a/wiretap/netmon.c b/wiretap/netmon.c index 65da2d8805..684509aeb6 100644 --- a/wiretap/netmon.c +++ b/wiretap/netmon.c @@ -203,7 +203,6 @@ int netmon_open(wtap *wth, int *err, gchar **err_info) /* Read in the string that should be at the start of a Network * Monitor file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, MAGIC_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -216,7 +215,6 @@ int netmon_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -358,7 +356,6 @@ int netmon_open(wtap *wth, int *err, gchar **err_info) *err = ENOMEM; /* we assume we're out of memory */ return -1; } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, frame_table, frame_table_length, err, err_info)) { g_free(frame_table); @@ -489,7 +486,6 @@ netmon_process_record(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, hdr_size = sizeof (struct netmonrec_2_x_hdr); break; } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &hdr, hdr_size, err, err_info)) return FAILURE; @@ -660,7 +656,6 @@ netmon_process_record(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, } } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &trlr, trlr_size, err, err_info)) return FAILURE; @@ -876,7 +871,6 @@ netmon_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, struct netmon_atm_hdr atm_phdr; guint16 vpi, vci; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &atm_phdr, sizeof (struct netmon_atm_hdr), err, err_info)) return FALSE; diff --git a/wiretap/netscaler.c b/wiretap/netscaler.c index 03aba5bf74..1c28c5f11b 100644 --- a/wiretap/netscaler.c +++ b/wiretap/netscaler.c @@ -674,7 +674,6 @@ int nstrace_open(wtap *wth, int *err, gchar **err_info) gint32 page_size; nstrace_t *nstrace; - errno = WTAP_ERR_CANT_READ; if ((file_size = wtap_file_size(wth, err)) == -1) return 0; diff --git a/wiretap/nettl.c b/wiretap/nettl.c index 1752225278..b45652d4c4 100644 --- a/wiretap/nettl.c +++ b/wiretap/nettl.c @@ -195,7 +195,6 @@ int nettl_open(wtap *wth, int *err, gchar **err_info) memset(&file_hdr, 0, sizeof(file_hdr)); /* Read in the string that should be at the start of a HP file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, file_hdr.magic, MAGIC_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -341,7 +340,6 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, int bytes_to_read; guint8 *pd; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &rec_hdr.hdr_len, sizeof rec_hdr.hdr_len, err, err_info)) return FALSE; @@ -586,7 +584,6 @@ nettl_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, */ ws_buffer_assure_space(buf, datalen); pd = ws_buffer_start_ptr(buf); - errno = WTAP_ERR_CANT_READ; if (fddihack) { /* read in FC, dest, src, DSAP and SSAP */ bytes_to_read = 15; diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c index 555414253c..64b96375b6 100644 --- a/wiretap/network_instruments.c +++ b/wiretap/network_instruments.c @@ -123,7 +123,6 @@ int network_instruments_open(wtap *wth, int *err, gchar **err_info) packet_entry_header packet_header; observer_dump_private_state * private_state = NULL; - errno = WTAP_ERR_CANT_READ; offset = 0; /* read in the buffer file header */ diff --git a/wiretap/netxray.c b/wiretap/netxray.c index fa8573839e..d6d37535a9 100644 --- a/wiretap/netxray.c +++ b/wiretap/netxray.c @@ -460,7 +460,6 @@ netxray_open(wtap *wth, int *err, gchar **err_info) /* Read in the string that should be at the start of a NetXRay * file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, MAGIC_SIZE, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -476,7 +475,6 @@ netxray_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -1139,7 +1137,6 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, hdr_size = sizeof (struct netxrayrec_2_x_hdr); break; } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, (void *)&hdr, hdr_size, err, err_info)) { /* * If *err is 0, we're at EOF. *err being 0 and a return diff --git a/wiretap/ngsniffer.c b/wiretap/ngsniffer.c index b29840bbfc..aa3a51494f 100644 --- a/wiretap/ngsniffer.c +++ b/wiretap/ngsniffer.c @@ -574,7 +574,6 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) ngsniffer_t *ngsniffer; /* Read in the string that should be at the start of a Sniffer file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -589,7 +588,6 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) * Read the first record, which the manual says is a version * record. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, record_type, 2, err, err_info)) return -1; if (!wtap_read_bytes(wth->fh, record_length, 4, err, err_info)) @@ -603,7 +601,6 @@ ngsniffer_open(wtap *wth, int *err, gchar **err_info) return -1; } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &version, sizeof version, err, err_info)) return -1; @@ -788,7 +785,6 @@ process_header_records(wtap *wth, int *err, gchar **err_info, gint16 maj_vers, unsigned char buffer[256]; for (;;) { - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(wth->fh, record_type, 2, err, err_info)) { if (*err != 0) return -1; @@ -813,7 +809,6 @@ process_header_records(wtap *wth, int *err, gchar **err_info, gint16 maj_vers, return 0; } - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, record_length, 4, err, err_info)) return -1; @@ -2426,7 +2421,6 @@ ng_file_read(void *buffer, unsigned int nbytes, wtap *wth, gboolean is_random, } if (wth->file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED) { - errno = WTAP_ERR_CANT_READ; copied_bytes = file_read(buffer, copybytes, infile); if ((unsigned int) copied_bytes != copybytes) *err = file_error(infile, err_info); @@ -2533,7 +2527,6 @@ read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream, int *err, int out_len; /* Read one 16-bit word which is length of next compressed blob */ - errno = WTAP_ERR_CANT_READ; read_len = file_read(&blob_len, 2, infile); if (2 != read_len) { *err = file_error(infile, err_info); @@ -2555,7 +2548,6 @@ read_blob(FILE_T infile, ngsniffer_comp_stream_t *comp_stream, int *err, file_inbuf = (unsigned char *)g_malloc(INBUF_SIZE); /* Read the blob */ - errno = WTAP_ERR_CANT_READ; read_len = file_read(file_inbuf, in_len, infile); if ((size_t) in_len != read_len) { *err = file_error(infile, err_info); diff --git a/wiretap/pcap-common.c b/wiretap/pcap-common.c index a4e39c1cb9..a28c3248fc 100644 --- a/wiretap/pcap-common.c +++ b/wiretap/pcap-common.c @@ -813,7 +813,6 @@ pcap_read_sunatm_pseudoheader(FILE_T fh, guint8 vpi; guint16 vci; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, atm_phdr, SUNATM_LEN, err, err_info)) return FALSE; @@ -895,7 +894,6 @@ pcap_read_nokiaatm_pseudoheader(FILE_T fh, guint8 vpi; guint16 vci; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, atm_phdr, NOKIAATM_LEN, err, err_info)) return FALSE; @@ -922,7 +920,6 @@ pcap_read_nokia_pseudoheader(FILE_T fh, { guint8 phdr[NOKIA_LEN]; - errno = WTAP_ERR_CANT_READ; /* backtrack to read the 4 mysterious bytes that aren't considered * part of the packet size @@ -949,7 +946,6 @@ pcap_read_irda_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, { guint8 irda_phdr[IRDA_SLL_LEN]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, irda_phdr, IRDA_SLL_LEN, err, err_info)) return FALSE; @@ -970,7 +966,6 @@ pcap_read_mtp2_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, { guint8 mtp2_hdr[MTP2_HDR_LEN]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, mtp2_hdr, MTP2_HDR_LEN, err, err_info)) return FALSE; @@ -987,7 +982,6 @@ pcap_read_lapd_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, { guint8 lapd_phdr[LAPD_SLL_LEN]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, lapd_phdr, LAPD_SLL_LEN, err, err_info)) return FALSE; @@ -1009,7 +1003,6 @@ pcap_read_sita_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, { guint8 sita_phdr[SITA_HDR_LEN]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, sita_phdr, SITA_HDR_LEN, err, err_info)) return FALSE; @@ -1346,7 +1339,6 @@ pcap_read_bt_pseudoheader(FILE_T fh, { struct libpcap_bt_phdr phdr; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_bt_phdr), err, err_info)) return FALSE; @@ -1360,7 +1352,6 @@ pcap_read_bt_monitor_pseudoheader(FILE_T fh, { struct libpcap_bt_monitor_phdr phdr; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_bt_monitor_phdr), err, err_info)) return FALSE; @@ -1376,7 +1367,6 @@ pcap_read_llcp_pseudoheader(FILE_T fh, { guint8 phdr[LLCP_HEADER_LEN]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, phdr, LLCP_HEADER_LEN, err, err_info)) return FALSE; pseudo_header->llcp.adapter = phdr[LLCP_ADAPTER_OFFSET]; @@ -1390,7 +1380,6 @@ pcap_read_ppp_pseudoheader(FILE_T fh, { struct libpcap_ppp_phdr phdr; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &phdr, sizeof (struct libpcap_ppp_phdr), err, err_info)) return FALSE; @@ -1404,7 +1393,6 @@ pcap_read_erf_pseudoheader(FILE_T fh, struct wtap_pkthdr *whdr, { guint8 erf_hdr[sizeof(struct erf_phdr)]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, erf_hdr, sizeof(struct erf_phdr), err, err_info)) return FALSE; pseudo_header->erf.phdr.ts = pletoh64(&erf_hdr[0]); /* timestamp */ @@ -1446,7 +1434,6 @@ pcap_read_erf_exheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, *psize = 0; if (pseudo_header->erf.phdr.type & 0x80){ do{ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, erf_exhdr, 8, err, err_info)) return FALSE; type = erf_exhdr[0]; @@ -1480,7 +1467,6 @@ pcap_read_erf_subheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, case ERF_TYPE_MC_AAL2: case ERF_TYPE_COLOR_MC_HDLC_POS: /* Extract the Multi Channel header to include it in the pseudo header part */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, erf_subhdr, sizeof(erf_mc_header_t), err, err_info)) return FALSE; pseudo_header->erf.subhdr.mc_hdr = pntoh32(&erf_subhdr[0]); @@ -1490,7 +1476,6 @@ pcap_read_erf_subheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, case ERF_TYPE_COLOR_ETH: case ERF_TYPE_DSM_COLOR_ETH: /* Extract the Ethernet additional header to include it in the pseudo header part */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, erf_subhdr, sizeof(erf_eth_header_t), err, err_info)) return FALSE; pseudo_header->erf.subhdr.eth_hdr = pntoh16(&erf_subhdr[0]); @@ -1508,7 +1493,6 @@ pcap_read_i2c_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, i { struct i2c_file_hdr i2c_hdr; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &i2c_hdr, sizeof (i2c_hdr), err, err_info)) return FALSE; diff --git a/wiretap/pcapng.c b/wiretap/pcapng.c index 201588b22d..eef773ef8d 100644 --- a/wiretap/pcapng.c +++ b/wiretap/pcapng.c @@ -435,7 +435,6 @@ pcapng_read_option(FILE_T fh, pcapng_t *pn, pcapng_option_header_t *oh, } /* read option header */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, oh, sizeof (*oh), err, err_info)) { pcapng_debug0("pcapng_read_option: failed to read option"); return -1; @@ -461,7 +460,6 @@ pcapng_read_option(FILE_T fh, pcapng_t *pn, pcapng_option_header_t *oh, } /* read option content */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, content, oh->option_length, err, err_info)) { pcapng_debug1("pcapng_read_option: failed to read content of option %u", oh->option_code); return -1; @@ -521,7 +519,6 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block, } /* read block content */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &shb, sizeof shb, err, err_info)) { if (*err == WTAP_ERR_SHORT_READ) { if (first_block) { @@ -615,7 +612,6 @@ pcapng_read_section_header_block(FILE_T fh, gboolean first_block, } /* Options */ - errno = WTAP_ERR_CANT_READ; to_read = bh->block_total_length - MIN_SHB_SIZE; /* Allocate enough memory to hold all options */ @@ -737,7 +733,6 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, } /* read block content */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &idb, sizeof idb, err, err_info)) { pcapng_debug0("pcapng_read_if_descr_block: failed to read IDB"); return -1; @@ -791,7 +786,6 @@ pcapng_read_if_descr_block(wtap *wth, FILE_T fh, pcapng_block_header_t *bh, /* Options */ - errno = WTAP_ERR_CANT_READ; to_read = bh->block_total_length - MIN_IDB_SIZE; /* Allocate enough memory to hold all options */ @@ -1033,7 +1027,6 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta } /* "(Enhanced) Packet Block" read fixed part */ - errno = WTAP_ERR_CANT_READ; if (enhanced) { /* * Is this block long enough to be an EPB? @@ -1209,7 +1202,6 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta wblock->packet_header->ts.nsecs = (int)(((ts % iface_info.time_units_per_second) * 1000000000) / iface_info.time_units_per_second); /* "(Enhanced) Packet Block" read capture data */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_packet_bytes(fh, wblock->frame_buffer, packet.cap_len - pseudo_header_len, err, err_info)) return -1; @@ -1236,7 +1228,6 @@ pcapng_read_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t *pn, wta * epb_hash 3 * epb_dropcount 4 */ - errno = WTAP_ERR_CANT_READ; to_read = block_total_length - (int)sizeof(pcapng_block_header_t) - block_read - /* fixed and variable part, including padding */ @@ -1370,7 +1361,6 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t * } /* "Simple Packet Block" read fixed part */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &spb, sizeof spb, err, err_info)) { pcapng_debug0("pcapng_read_simple_packet_block: failed to read packet data"); return -1; @@ -1480,7 +1470,6 @@ pcapng_read_simple_packet_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t * memset((void *)&wblock->packet_header->pseudo_header, 0, sizeof(union wtap_pseudo_header)); /* "Simple Packet Block" read capture data */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_packet_bytes(fh, wblock->frame_buffer, simple_packet.cap_len, err, err_info)) return -1; @@ -1583,7 +1572,6 @@ pcapng_read_name_resolution_block(FILE_T fh, pcapng_block_header_t *bh, pcapng_t return -1; } - errno = WTAP_ERR_CANT_READ; to_read = bh->block_total_length - 8 - 4; /* We have read the header adn should not read the final block_total_length */ pcapng_debug1("pcapng_read_name_resolution_block, total %d bytes", bh->block_total_length); @@ -1808,7 +1796,6 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, pca } /* "Interface Statistics Block" read fixed part */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &isb, sizeof isb, err, err_info)) { pcapng_debug0("pcapng_read_interface_statistics_block: failed to read packet data"); return -1; @@ -1835,7 +1822,6 @@ pcapng_read_interface_statistics_block(FILE_T fh, pcapng_block_header_t *bh, pca wblock->data.if_stats.isb_usrdeliv = -1; /* Options */ - errno = WTAP_ERR_CANT_READ; to_read = bh->block_total_length - (MIN_BLOCK_SIZE + block_read); /* fixed and variable part, including padding */ @@ -2055,7 +2041,6 @@ pcapng_read_block(wtap *wth, FILE_T fh, gboolean first_block, pcapng_t *pn, wtap memset(&(wblock->data), 0, sizeof(wblock->data)); /* Try to read the (next) block header */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &bh, sizeof bh, err, err_info)) { pcapng_debug1("pcapng_read_block: wtap_read_bytes_or_eof() failed, err = %d.", *err); if (*err == 0 || *err == WTAP_ERR_SHORT_READ) { @@ -2128,7 +2113,6 @@ pcapng_read_block(wtap *wth, FILE_T fh, gboolean first_block, pcapng_t *pn, wtap block_read += bytes_read; /* sanity check: first and second block lengths must match */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &block_total_length, sizeof block_total_length, err, err_info)) { pcapng_debug0("pcapng_read_block: couldn't read second block length"); @@ -2271,7 +2255,6 @@ pcapng_open(wtap *wth, int *err, gchar **err_info) /* peek at next block */ /* Try to read the (next) block header */ saved_offset = file_tell(wth->fh); - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(wth->fh, &bh, sizeof bh, err, err_info)) { if (*err == 0) { /* EOF */ diff --git a/wiretap/radcom.c b/wiretap/radcom.c index 188882fd24..52c7cdc05d 100644 --- a/wiretap/radcom.c +++ b/wiretap/radcom.c @@ -101,7 +101,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) #endif /* Read in the string that should be at the start of a RADCOM file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, r_magic, 8, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -120,7 +119,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) /* Look for the "Active Time" string. The "frame_date" structure should * be located 32 bytes before the beginning of this string */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, t_magic, 11, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -130,7 +128,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) { if (file_seek(wth->fh, -10, SEEK_CUR, err) == -1) return -1; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, t_magic, 11, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -140,7 +137,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) if (file_seek(wth->fh, -43, SEEK_CUR, err) == -1) return -1; /* Get capture start time */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &start_date, sizeof(struct frame_date), err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) @@ -152,7 +148,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) return -1; for (;;) { - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, search_encap, 4, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) @@ -174,7 +169,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) } if (file_seek(wth->fh, 12, SEEK_CUR, err) == -1) return -1; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, search_encap, 4, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -212,7 +206,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) } #if 0 - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &next_date, sizeof(struct frame_date), err, err_info)) return -1; @@ -220,7 +213,6 @@ int radcom_open(wtap *wth, int *err, gchar **err_info) while (memcmp(&start_date, &next_date, 4)) { if (file_seek(wth->fh, 1-sizeof(struct frame_date), SEEK_CUR, err) == -1) return -1; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &next_date, sizeof(struct frame_date), err, err_info)) return -1; @@ -261,7 +253,6 @@ static gboolean radcom_read(wtap *wth, int *err, gchar **err_info, XXX - should we have some way of indicating the presence and size of an FCS to our caller? That'd let us handle other file types as well. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &fcs, sizeof fcs, err, err_info)) return FALSE; } @@ -300,7 +291,6 @@ radcom_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, struct tm tm; guint8 atmhdr[8]; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &hdr, sizeof hdr, err, err_info)) return FALSE; @@ -350,7 +340,6 @@ radcom_read_rec(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf, * XXX - is this stuff a pseudo-header? * The direction appears to be in the "hdr.dce" field. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, atmhdr, sizeof atmhdr, err, err_info)) return FALSE; /* Read error */ diff --git a/wiretap/snoop.c b/wiretap/snoop.c index 9d17570389..b8c64f9de9 100644 --- a/wiretap/snoop.c +++ b/wiretap/snoop.c @@ -253,7 +253,6 @@ int snoop_open(wtap *wth, int *err, gchar **err_info) gint64 saved_offset; /* Read in the string that should be at the start of a "snoop" file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) return -1; @@ -265,7 +264,6 @@ int snoop_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -321,7 +319,6 @@ int snoop_open(wtap *wth, int *err, gchar **err_info) /* Read first record header. */ saved_offset = file_tell(wth->fh); - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(wth->fh, &rec_hdr, sizeof rec_hdr, err, err_info)) { if (*err != 0) return -1; @@ -482,7 +479,6 @@ snoop_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, int header_size; /* Read record header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &hdr, sizeof hdr, err, err_info)) return -1; @@ -629,7 +625,6 @@ snoop_read_atm_pseudoheader(FILE_T fh, union wtap_pseudo_header *pseudo_header, guint8 vpi; guint16 vci; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &atm_phdr, sizeof atm_phdr, err, err_info)) return FALSE; @@ -716,7 +711,6 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh, shomiti_wireless_header whdr; int rsize; - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &whdr, sizeof whdr, err, err_info)) return FALSE; diff --git a/wiretap/visual.c b/wiretap/visual.c index 0aedeb3a73..d781e3651a 100644 --- a/wiretap/visual.c +++ b/wiretap/visual.c @@ -179,7 +179,6 @@ int visual_open(wtap *wth, int *err, gchar **err_info) int encap; /* Check the magic string at the start of the file */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, magic, sizeof magic, err, err_info)) { if (*err != WTAP_ERR_SHORT_READ) @@ -192,7 +191,6 @@ int visual_open(wtap *wth, int *err, gchar **err_info) } /* Read the rest of the file header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(wth->fh, &vfile_hdr, sizeof vfile_hdr, err, err_info)) { return -1; @@ -327,7 +325,6 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, guint8 *pd; /* Read the packet header. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes_or_eof(fh, &vpkt_hdr, (unsigned int)sizeof vpkt_hdr, err, err_info)) { return FALSE; @@ -445,7 +442,6 @@ visual_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr, ATM packets have an additional packet header; read and process it. */ - errno = WTAP_ERR_CANT_READ; if (!wtap_read_bytes(fh, &vatm_hdr, (unsigned int)sizeof vatm_hdr, err, err_info)) { return FALSE; diff --git a/wiretap/vwr.c b/wiretap/vwr.c index 1a76c6c759..43cedd33fe 100644 --- a/wiretap/vwr.c +++ b/wiretap/vwr.c @@ -635,7 +635,6 @@ static gboolean vwr_read_rec_header(vwr_t *vwr, FILE_T fh, int *rec_size, int *I int f_len, v_type; guint8 header[VW_RECORD_HEADER_LENGTH]; - errno = WTAP_ERR_CANT_READ; *rec_size = 0; /* Read out the file data in 16-byte messages, stopping either after we find a frame, */ diff --git a/wiretap/wtap.c b/wiretap/wtap.c index ff3d88a975..cd64e9930f 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -813,31 +813,82 @@ wtap_short_string_to_encap(const char *short_name) } static const char *wtap_errlist[] = { + /* WTAP_ERR_NOT_REGULAR_FILE */ "The file isn't a plain file or pipe", + + /* WTAP_ERR_RANDOM_OPEN_PIPE */ "The file is being opened for random access but is a pipe", + + /* WTAP_ERR_FILE_UNKNOWN_FORMAT */ "The file isn't a capture file in a known format", + + /* WTAP_ERR_UNSUPPORTED */ "File contains record data we don't support", + + /* WTAP_ERR_CANT_WRITE_TO_PIPE */ "That file format cannot be written to a pipe", + + /* WTAP_ERR_CANT_OPEN */ NULL, + + /* WTAP_ERR_UNSUPPORTED_FILE_TYPE */ "Files can't be saved in that format", + + /* WTAP_ERR_UNSUPPORTED_ENCAP */ "Files from that network type can't be saved in that format", + + /* WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED */ "That file format doesn't support per-packet encapsulations", + + /* WTAP_ERR_CANT_WRITE */ NULL, + + /* WTAP_ERR_CANT_CLOSE */ NULL, + + /* WTAP_ERR_SHORT_READ */ "Less data was read than was expected", + + /* WTAP_ERR_BAD_FILE */ "The file appears to be damaged or corrupt", + + /* WTAP_ERR_SHORT_WRITE */ "Less data was written than was requested", + + /* WTAP_ERR_UNC_TRUNCATED */ "Uncompression error: data oddly truncated", + + /* WTAP_ERR_UNC_OVERFLOW */ "Uncompression error: data would overflow buffer", + + /* WTAP_ERR_UNC_BAD_OFFSET */ "Uncompression error: bad LZ77 offset", + + /* WTAP_ERR_RANDOM_OPEN_STDIN */ "The standard input cannot be opened for random access", + + /* WTAP_ERR_COMPRESSION_NOT_SUPPORTED */ "That file format doesn't support compression", + + /* WTAP_ERR_CANT_SEEK */ NULL, + + /* WTAP_ERR_CANT_SEEK_COMPRESSED */ NULL, + + /* WTAP_ERR_DECOMPRESS */ "Uncompression error", + + /* WTAP_ERR_INTERNAL */ "Internal error", + + /* WTAP_ERR_PACKET_TOO_LARGE */ "The packet being written is too large for that format", + + /* WTAP_ERR_CHECK_WSLUA */ NULL, + + /* WTAP_ERR_REC_TYPE_UNSUPPORTED */ "That record type cannot be written in that format" }; #define WTAP_ERRLIST_SIZE (sizeof wtap_errlist / sizeof wtap_errlist[0]) @@ -1108,7 +1159,6 @@ wtap_read_packet_bytes(FILE_T fh, Buffer *buf, guint length, int *err, gchar **err_info) { ws_buffer_assure_space(buf, length); - errno = WTAP_ERR_CANT_READ; return wtap_read_bytes(fh, ws_buffer_start_ptr(buf), length, err, err_info); } diff --git a/wiretap/wtap.h b/wiretap/wtap.h index e58134a2f0..3dd525826b 100644 --- a/wiretap/wtap.h +++ b/wiretap/wtap.h @@ -1636,12 +1636,12 @@ int wtap_register_encap_type(const char* name, const char* short_name); #define WTAP_ERR_ENCAP_PER_PACKET_UNSUPPORTED -9 /** The specified format doesn't support per-packet encapsulations */ -#define WTAP_ERR_CANT_CLOSE -10 - /** The file couldn't be closed, reason unknown */ - -#define WTAP_ERR_CANT_READ -11 +#define WTAP_ERR_CANT_WRITE -10 /** An attempt to read failed, reason unknown */ +#define WTAP_ERR_CANT_CLOSE -11 + /** The file couldn't be closed, reason unknown */ + #define WTAP_ERR_SHORT_READ -12 /** An attempt to read read less data than it should have */ |