summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/systrace/policy.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/bin/systrace/policy.c b/bin/systrace/policy.c
index ac077ae49b2..17311f4cdd9 100644
--- a/bin/systrace/policy.c
+++ b/bin/systrace/policy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: policy.c,v 1.15 2002/08/07 00:34:17 vincent Exp $ */
+/* $OpenBSD: policy.c,v 1.16 2002/08/30 17:09:21 itojun Exp $ */
/*
* Copyright 2002 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
@@ -397,8 +397,20 @@ systrace_readpolicy(char *filename)
}
*p = '\0';
- p = line;
- strsep(&p, "#");
+ p = strchr(line, '#');
+ if (p != NULL) {
+ if (p != line && *(p-1) == '-')
+ p = strchr(p + 1, '#');
+ if (p != NULL)
+ *p = '\0';
+ }
+
+ p = line + strlen(line) - 1;
+ while (p > line) {
+ if (!isspace(*p))
+ break;
+ *p-- = '\0';
+ }
p = line;
p += strspn(p, " \t");