aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/peektagged.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-12-27 22:59:39 +0000
committerGuy Harris <guy@alum.mit.edu>2012-12-27 22:59:39 +0000
commitd8b37bafb761f9feaacf5bc6a3aad7e5254159f9 (patch)
tree60a112f6e043dc3420d353f1d86b5ee1a30edd2c /wiretap/peektagged.c
parentbb3b34d7bfd1e8510b478fe4ad7a7ba0079ab1b0 (diff)
Errors take precedence over EOF; use file_error() after operations that
return an "EOF or error" indication - an EOF without an error will return 0. In iseries_seek_next_packet(), return an error code of WTAP_ERR_BAD_FILE and an appropriate error message if we don't find a packet header within the next ISERIES_MAX_TRACE_LEN lines, don't just return -1 and leave the error information unchanged. Setting an argument variable before returning has no effect, so don't do it (so that we don't leave the mistaken impression that it *is* doing something). Clean up indentation. svn path=/trunk/; revision=46819
Diffstat (limited to 'wiretap/peektagged.c')
-rw-r--r--wiretap/peektagged.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index 98a3cafacb..9792ffd7b7 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -108,13 +108,12 @@ static int wtap_file_read_pattern (wtap *wth, const char *pattern, int *err,
while (*cp)
{
c = file_getc(wth->fh);
- if (c == EOF) {
- if (file_eof(wth->fh))
- return 0; /* EOF */
- else {
- *err = file_error(wth->fh, err_info);
+ if (c == EOF)
+ {
+ *err = file_error(wth->fh, err_info);
+ if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1; /* error */
- }
+ return 0; /* EOF */
}
if (c == *cp)
cp++;
@@ -141,13 +140,12 @@ static int wtap_file_read_till_separator (wtap *wth, char *buffer, int buflen,
for (cp = buffer, i = 0; i < buflen; i++, cp++)
{
c = file_getc(wth->fh);
- if (c == EOF) {
- if (file_eof(wth->fh))
- return 0; /* EOF */
- else {
- *err = file_error(wth->fh, err_info);
+ if (c == EOF)
+ {
+ *err = file_error(wth->fh, err_info);
+ if (*err != 0 && *err != WTAP_ERR_SHORT_READ)
return -1; /* error */
- }
+ return 0; /* EOF */
}
if (strchr (separators, c) != NULL)
{