summaryrefslogtreecommitdiff
path: root/regress/sys
diff options
context:
space:
mode:
authorSebastien Marie <semarie@cvs.openbsd.org>2015-10-18 12:25:34 +0000
committerSebastien Marie <semarie@cvs.openbsd.org>2015-10-18 12:25:34 +0000
commit7cd83d05699c46a2db6f27125be7dec49f7090ff (patch)
treea9548245e78f483b1215e366327e7d10ad234a00 /regress/sys
parentfa021c02348bb825a14c9270969d6203b7346d99 (diff)
regress pledge: tweak a bit the manner to grab hte syscall number
permit debug string be present on the line
Diffstat (limited to 'regress/sys')
-rw-r--r--regress/sys/kern/pledge/generic/manager.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/regress/sys/kern/pledge/generic/manager.c b/regress/sys/kern/pledge/generic/manager.c
index 1f5ead155e4..4f8121cd1fa 100644
--- a/regress/sys/kern/pledge/generic/manager.c
+++ b/regress/sys/kern/pledge/generic/manager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: manager.c,v 1.2 2015/10/09 11:38:05 semarie Exp $ */
+/* $OpenBSD: manager.c,v 1.3 2015/10/18 12:25:33 semarie Exp $ */
/*
* Copyright (c) 2015 Sebastien Marie <semarie@openbsd.org>
*
@@ -18,6 +18,7 @@
#include <sys/syslimits.h>
#include <sys/wait.h>
+#include <ctype.h>
#include <err.h>
#include <errno.h>
#include <fcntl.h>
@@ -125,7 +126,14 @@ grab_syscall(pid_t pid)
/* check if found */
if (strncmp(search, line, searchlen) == 0) {
const char *errstr = NULL;
- /* found */
+ char *c;
+ /* truncate at first no-number */
+ for (c = line + searchlen; (*c != '\0') && isdigit(*c);
+ c++)
+ ;
+ *c = '\0';
+
+ /* convert it */
ret = strtonum(line + searchlen, 0, 255, &errstr);
if (errstr) {
warn("strtonum: line=%s err=%s", line, errstr);