aboutsummaryrefslogtreecommitdiff
path: root/src/binlogsel.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@nxc.no>2014-06-01 15:32:25 +0200
committerSergey Poznyakoff <gray@nxc.no>2014-06-01 15:34:19 +0200
commit6054989b78b7a481770a1608c809a56e1cf5cc7d (patch)
tree23404bef612baef8fbc97364b012496cf0db9c7b /src/binlogsel.c
parent6c0f32b6f37bbb70445731988b5ac180ef054357 (diff)
downloadvmod-binlog-6054989b78b7a481770a1608c809a56e1cf5cc7d.tar.gz
vmod-binlog-6054989b78b7a481770a1608c809a56e1cf5cc7d.tar.bz2
Fix -d (timediff) option in binlogsel.
* src/binlogsel.c (selmem): Don't attempt to modify rec.
Diffstat (limited to 'src/binlogsel.c')
-rw-r--r--src/binlogsel.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/binlogsel.c b/src/binlogsel.c
index d44c1b8..b3fb75b 100644
--- a/src/binlogsel.c
+++ b/src/binlogsel.c
@@ -273,8 +273,8 @@ searchts(void *base, size_t recsize, size_t from, size_t to, time_t ts,
void
selmem(const char *name, void *base)
{
- struct binlog_file_header *hdr;
- struct binlog_record *rec;
+ struct binlog_file_header const *hdr;
+ struct binlog_record const *rec;
struct packenv *env;
struct packinst *inst;
char *p;
@@ -350,15 +350,19 @@ selmem(const char *name, void *base)
start = 0;
for (i = 0; start < hdr->recnum; i++, start++) {
+ time_t ts;
+
rec = getrec(base, hdr->recsize, start);
if ((timemask & STOP_TIME) && rec->ts > to_time)
break;
+ ts = rec->ts;
+
if (timediff_option) {
if (i == 0)
- start_ts = rec->ts;
- rec->ts -= start_ts;
+ start_ts = ts;
+ ts -= start_ts;
}
strftime(timebuf, sizeof timebuf, timefmt,
localtime(&rec->ts));
@@ -372,7 +376,7 @@ selmem(const char *name, void *base)
last_ts = rec->ts;
if (module_record)
- module_record(ip->name, rec->ts, env->buf_base);
+ module_record(ip->name, ts, env->buf_base);
else {
if (ip->name)
printf("%s ", ip->name);

Return to:

Send suggestions and report system problems to the System administrator.