summaryrefslogtreecommitdiff
path: root/wiretap/ngsniffer.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2014-10-07 16:18:47 -0700
committerGuy Harris <guy@alum.mit.edu>2014-10-07 23:19:56 +0000
commita566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11 (patch)
tree1730a9b5c9cc7704273e4104a426e6987f9ef9b6 /wiretap/ngsniffer.c
parent5e0e4fa9e4de39f9402e6472e6b25439f8464c24 (diff)
downloadwireshark-a566f617d8f712a8f4d1fe7b6d9b9f6ebe79ba11.tar.gz
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/ngsniffer.c')
-rw-r--r--wiretap/ngsniffer.c8
1 files changed, 0 insertions, 8 deletions
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);