On a read error, always return a pointer to the merge_in_file_t for the

file from which we got the error.

On a successful read, always clear out err - wtap_read() doesn't set *err
on success.

svn path=/trunk/; revision=42854
This commit is contained in:
Guy Harris 2012-05-25 18:50:47 +00:00
parent 3e24d3bbce
commit ce9bd39893
1 changed files with 10 additions and 3 deletions

13
merge.c
View File

@ -184,7 +184,7 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
if (!wtap_read(in_files[i].wth, err, err_info, &in_files[i].data_offset)) {
if (*err != 0) {
in_files[i].state = GOT_ERROR;
return NULL;
return &in_files[i];
}
in_files[i].state = AT_EOF;
} else
@ -212,7 +212,11 @@ merge_read_packet(int in_file_count, merge_in_file_t in_files[],
/* Count this packet. */
in_files[ei].packet_num++;
/* Return the ordinal of the file from which the packet was read. */
/*
* Return a pointer to the merge_in_file_t of the file from which the
* packet was read.
*/
*err = 0;
return &in_files[ei];
}
@ -257,7 +261,10 @@ merge_append_read_packet(int in_file_count, merge_in_file_t in_files[],
return NULL;
}
/* Return the ordinal of the file from which the packet was read. */
/*
* Return a pointer to the merge_in_file_t of the file from which the
* packet was read.
*/
*err = 0;
return &in_files[i];
}