diff options
author | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-08-30 17:09:22 +0000 |
---|---|---|
committer | Jun-ichiro itojun Hagino <itojun@cvs.openbsd.org> | 2002-08-30 17:09:22 +0000 |
commit | d2b971680dc9275cfb7b55235a99c57200448c07 (patch) | |
tree | d963565837dead8ca94133c4b59a8478b965e7db /bin | |
parent | 2e38499cf7af3d26f705d646ba0fcafb43d71257 (diff) |
allow # in system call name. remove trailing white space.
from provos
Diffstat (limited to 'bin')
-rw-r--r-- | bin/systrace/policy.c | 18 |
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"); |