diff options
author | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-01-12 21:41:30 +0000 |
---|---|---|
committer | ulfl <ulfl@f5534014-38df-0310-8fa8-9805f1628bb7> | 2005-01-12 21:41:30 +0000 |
commit | 223ed95c98bc15e02fa64ba795ab2ffa3588e2e9 (patch) | |
tree | 498d2df4904e293ccf6af66e324afcd3ecf1126c /ringbuffer.c | |
parent | f304bc4c0112d5643ae613aec0ee5a8224eabb0e (diff) |
don't use two variables for keeping the current ringbuffer file number
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@13009 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'ringbuffer.c')
-rw-r--r-- | ringbuffer.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/ringbuffer.c b/ringbuffer.c index 651f2a25b1..cc633eab3c 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -97,13 +97,17 @@ typedef struct _ringbuf_data { int filetype; int linktype; int snaplen; - guint16 number; + int fd; /* Current ringbuffer file descriptor */ wtap_dumper *pdh; } ringbuf_data; static ringbuf_data rb_data; + +/* + * create the next filename and open a new binary file with that name + */ static int ringbuf_open_file(rb_file *rfile, int *err) { char filenum[5+1]; @@ -123,9 +127,7 @@ static int ringbuf_open_file(rb_file *rfile, int *err) #endif current_time = time(NULL); - rb_data.number++; - - snprintf(filenum, sizeof(filenum), "%05d", rb_data.number); + snprintf(filenum, sizeof(filenum), "%05d", rb_data.curr_file_num + 1 /*.number*/); strftime(timestr, sizeof(timestr), "%Y%m%d%H%M%S", localtime(¤t_time)); rfile->name = g_strconcat(rb_data.fprefix, "_", filenum, "_", timestr, rb_data.fsuffix, NULL); @@ -161,7 +163,6 @@ ringbuf_init(const char *capfile_name, guint num_files) rb_data.unlimited = FALSE; rb_data.fd = -1; rb_data.pdh = NULL; - rb_data.number = 0; /* just to be sure ... */ if (num_files <= RINGBUFFER_MAX_NUM_FILES) { |