diff options
author | Michael Tüxen <tuexen@fh-muenster.de> | 2013-01-03 09:51:51 +0000 |
---|---|---|
committer | Michael Tüxen <tuexen@fh-muenster.de> | 2013-01-03 09:51:51 +0000 |
commit | 674567df8abe915ff37e36a902dc917221e627a9 (patch) | |
tree | 955a4543c97aa3084a348ad26207694e20d561e9 /text2pcap.c | |
parent | 441b5b1bb567666c01f56b66346fd7f3b512be65 (diff) |
Cleanup error handling when processing preamble.
svn path=/trunk/; revision=46911
Diffstat (limited to 'text2pcap.c')
-rw-r--r-- | text2pcap.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/text2pcap.c b/text2pcap.c index 3243410a19..7463a3ddc8 100644 --- a/text2pcap.c +++ b/text2pcap.c @@ -906,16 +906,6 @@ parse_preamble (void) if (debug > 0) fprintf(stderr, "[[parse_preamble: \"%s\"]]\n", packet_preamble); - /* - * If no "-t" flag was specified, don't attempt to parse a packet - * preamble to extract a time stamp. - */ - if ((ts_fmt == NULL) && !has_direction) { - /* Clear Preamble */ - packet_preamble_len = 0; - return; - } - if (has_direction) { switch (packet_preamble[0]) { case 'i': @@ -942,20 +932,25 @@ parse_preamble (void) memmove(packet_preamble, packet_preamble+i, packet_preamble_len); } + /* - * Initialize to today localtime, just in case not all fields - * of the date and time are specified. + * If no "-t" flag was specified, don't attempt to parse the packet + * preamble to extract a time stamp. */ - - timecode = timecode_default; - ts_usec = 0; - if (ts_fmt == NULL) { /* Clear Preamble */ packet_preamble_len = 0; return; } + /* + * Initialize to today localtime, just in case not all fields + * of the date and time are specified. + */ + + timecode = timecode_default; + ts_usec = 0; + /* Ensure preamble has more than two chars before attempting to parse. * This should cover line breaks etc that get counted. */ |