summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2020-06-18 10:26:54 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2020-06-18 10:26:54 +0000
commitfa1298ce5bb867163f0ba131a102d14d8d88a59f (patch)
tree13db55e58196c4662df9ebb15fee1b90a365d00e /usr.sbin
parent97866eab46f22f8770b7af55ea6092e5d70b7170 (diff)
Apply rules to the number of events returned by the last read(2).
Fix a corner case where old events could be re-evaluated. From Yuichiro NAITO.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/btrace/btrace.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/usr.sbin/btrace/btrace.c b/usr.sbin/btrace/btrace.c
index fdf2a5eeda8..9df58cf35a4 100644
--- a/usr.sbin/btrace/btrace.c
+++ b/usr.sbin/btrace/btrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: btrace.c,v 1.18 2020/04/24 14:56:43 mpi Exp $ */
+/* $OpenBSD: btrace.c,v 1.19 2020/06/18 10:26:53 mpi Exp $ */
/*
* Copyright (c) 2019 - 2020 Martin Pieuchot <mpi@openbsd.org>
@@ -338,15 +338,8 @@ rules_do(int fd)
if ((rlen % sizeof(struct dt_evt)) != 0)
err(1, "incorrect read");
-
- for (i = 0; i < nitems(devtbuf); i++) {
- struct dt_evt *dtev = &devtbuf[i];
-
- if (dtev->dtev_tid == 0)
- break;
-
- rules_apply(dtev);
- }
+ for (i = 0; i < rlen / sizeof(struct dt_evt); i++)
+ rules_apply(&devtbuf[i]);
}
rules_teardown(fd);