diff options
author | Laurent Deniel <laurent.deniel@free.fr> | 1999-07-28 20:17:24 +0000 |
---|---|---|
committer | Laurent Deniel <laurent.deniel@free.fr> | 1999-07-28 20:17:24 +0000 |
commit | c42634dd820de5dbb8f80b5102d7ebd96c2ab41c (patch) | |
tree | 040abfbb6ce1a094da6ad72c0b6e9a163167a6df /wiretap/wtap.c | |
parent | e0b268397a59607cde2e48ecef75ca28afe7196e (diff) |
Fix the -S option :
- read only the real number of packets that have been written
by the child process. That's avoid incomplete packet read.
- special timeout handling no more necessary and the whole
real time capture and display behavior is much more
satisfying with this patch.
- wiretap modified to allow the reading of 'count' packets
with wtap_loop.
svn path=/trunk/; revision=398
Diffstat (limited to 'wiretap/wtap.c')
-rw-r--r-- | wiretap/wtap.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/wiretap/wtap.c b/wiretap/wtap.c index 359049aa6a..c05b491217 100644 --- a/wiretap/wtap.c +++ b/wiretap/wtap.c @@ -1,6 +1,6 @@ /* wtap.c * - * $Id: wtap.c,v 1.10 1999/07/13 02:53:26 gram Exp $ + * $Id: wtap.c,v 1.11 1999/07/28 20:17:24 deniel Exp $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@verdict.uthscsa.edu> @@ -74,10 +74,11 @@ void wtap_close(wtap *wth) void wtap_loop(wtap *wth, int count, wtap_handler callback, u_char* user) { - int data_offset; + int data_offset, loop = 0; while ((data_offset = wth->subtype_read(wth)) > 0) { callback(user, &wth->phdr, data_offset, buffer_start_ptr(wth->frame_buffer)); + if (count > 0 && ++loop >= count) break; } } |