diff options
Diffstat (limited to 'wiretap/netscreen.c')
-rw-r--r-- | wiretap/netscreen.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/wiretap/netscreen.c b/wiretap/netscreen.c index 8609afa7fa..de878dd64b 100644 --- a/wiretap/netscreen.c +++ b/wiretap/netscreen.c @@ -110,8 +110,8 @@ static gboolean info_line(const gchar *line) /* Seeks to the beginning of the next packet, and returns the byte offset. Copy the header line to hdr. Returns -1 on failure, - and sets "*err" to the error, sets "*err_info" to null or an - additional error string, and sets hdr to NULL. */ + and sets "*err" to the error and sets "*err_info" to null or an + additional error string. */ static gint64 netscreen_seek_next_packet(wtap *wth, int *err, gchar **err_info, char *hdr) { @@ -123,27 +123,19 @@ static gint64 netscreen_seek_next_packet(wtap *wth, int *err, gchar **err_info, if (cur_off == -1) { /* Error */ *err = file_error(wth->fh, err_info); - hdr = NULL; return -1; } - if (file_gets(buf, sizeof(buf), wth->fh) != NULL) { - if (strstr(buf, NETSCREEN_REC_MAGIC_STR1) || - strstr(buf, NETSCREEN_REC_MAGIC_STR2)) { - g_strlcpy(hdr, buf, NETSCREEN_LINE_LENGTH); - return cur_off; - } - } else { - if (file_eof(wth->fh)) { - /* We got an EOF. */ - *err = 0; - } else { - /* We got an error. */ - *err = file_error(wth->fh, err_info); - } + if (file_gets(buf, sizeof(buf), wth->fh) == NULL) { + /* EOF or error. */ + *err = file_error(wth->fh, err_info); break; } + if (strstr(buf, NETSCREEN_REC_MAGIC_STR1) || + strstr(buf, NETSCREEN_REC_MAGIC_STR2)) { + g_strlcpy(hdr, buf, NETSCREEN_LINE_LENGTH); + return cur_off; + } } - hdr = NULL; return -1; } |