[21/28] seccomp: Always setup chain flags

Submitted by Cyrill Gorcunov on March 20, 2018, 9:43 p.m.

Details

Message ID 20180320214313.25326-22-gorcunov@gmail.com
State Rejected
Series "seccomp, v2: Add support for per-thread tracking"
Headers show

Commit Message

Cyrill Gorcunov March 20, 2018, 9:43 p.m.
From: Cyrill Gorcunov <gorcunov@openvz.org>

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
 criu/seccomp.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

diff --git a/criu/seccomp.c b/criu/seccomp.c
index 63f1e98296cb..658e9b399ab6 100644
--- a/criu/seccomp.c
+++ b/criu/seccomp.c
@@ -171,6 +171,9 @@  static int collect_filter(struct seccomp_entry *entry)
 
 		seccomp_filter__init(&chain->filter);
 
+		chain->filter.has_flags = true;
+		chain->filter.flags = 0;
+
 		chain->filter.filter.len = len * sizeof(struct sock_filter);
 		chain->filter.filter.data = xmalloc(chain->filter.filter.len);
 		if (!chain->filter.filter.data) {
@@ -180,10 +183,8 @@  static int collect_filter(struct seccomp_entry *entry)
 
 		memcpy(chain->filter.filter.data, buf, chain->filter.filter.len);
 
-		if (meta) {
-			chain->filter.has_flags = true;
-			chain->filter.flags = meta->flags;
-		}
+		if (meta)
+			chain->filter.flags |= meta->flags;
 
 		prev = entry->chain, entry->chain = chain, chain->prev = prev;
 		entry->nr_chains++;