diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-10-26 11:17:53 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2015-10-26 11:17:53 +0000 |
commit | b5e19a7d83c8534f6f424ac92c41be9712d9c9eb (patch) | |
tree | fa4825fc6aff30d78433fc6221992b404ae86706 /usr.bin/kdump/kdump.c | |
parent | bcdaa51943b1537f0e07ca8e7e50422c7194f0d1 (diff) |
If the system call is entirely unpermitted, code will be 0, and there is
no pledge to recommend.
Diffstat (limited to 'usr.bin/kdump/kdump.c')
-rw-r--r-- | usr.bin/kdump/kdump.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c index 3dd62d94a80..ec0f3204e2a 100644 --- a/usr.bin/kdump/kdump.c +++ b/usr.bin/kdump/kdump.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kdump.c,v 1.117 2015/10/25 20:39:54 deraadt Exp $ */ +/* $OpenBSD: kdump.c,v 1.118 2015/10/26 11:17:52 deraadt Exp $ */ /*- * Copyright (c) 1988, 1993 @@ -1441,6 +1441,7 @@ ktrexec(const char *ptr, size_t len) static void ktrpledge(struct ktr_pledge *pledge, size_t len) { + char *name = ""; int i; if (len < sizeof(struct ktr_pledge)) @@ -1451,12 +1452,13 @@ ktrpledge(struct ktr_pledge *pledge, size_t len) else (void)printf("%s", current->sysnames[pledge->syscall]); printf(", "); - for (i = 0; pledgenames[i].bits != 0; i++) { + for (i = 0; pledge->code && pledgenames[i].bits != 0; i++) { if (pledgenames[i].bits & pledge->code) { - printf("\"%s\"", pledgenames[i].name); + name = pledgenames[i].name; break; } } + printf("\"%s\"", name); (void)printf(", errno %d", pledge->error); if (fancy) (void)printf(" %s", strerror(pledge->error)); |