diff options
author | 2015-11-16 17:43:17 +0000 | |
---|---|---|
committer | 2015-11-16 17:43:17 +0000 | |
commit | 77620a5c875acf946a490e23e7a93111cbd06e58 (patch) | |
tree | b99d44b391d0edb8f4c8d28bf5a0bb726fbb138b | |
parent | brk/sbrk's use case is way too narrow to be a default stdio pledge. (diff) | |
download | wireguard-openbsd-77620a5c875acf946a490e23e7a93111cbd06e58.tar.xz wireguard-openbsd-77620a5c875acf946a490e23e7a93111cbd06e58.zip |
pledge for gprof: "stdio rpath wpath cpath" in the beginning, then drop
wpath and cpath if we don't need to write a gmon.sum file (-s flag).
ok deraadt@
-rw-r--r-- | usr.bin/gprof/gprof.c | 9 | ||||
-rw-r--r-- | usr.bin/gprof/gprof.h | 3 |
2 files changed, 10 insertions, 2 deletions
diff --git a/usr.bin/gprof/gprof.c b/usr.bin/gprof/gprof.c index 2f38f9c3739..a83bcda6dd6 100644 --- a/usr.bin/gprof/gprof.c +++ b/usr.bin/gprof/gprof.c @@ -1,4 +1,4 @@ -/* $OpenBSD: gprof.c,v 1.22 2015/08/20 22:32:41 deraadt Exp $ */ +/* $OpenBSD: gprof.c,v 1.23 2015/11/16 17:43:17 pascal Exp $ */ /* $NetBSD: gprof.c,v 1.8 1995/04/19 07:15:59 cgd Exp $ */ /* @@ -44,6 +44,9 @@ main(int argc, char *argv[]) nltype **timesortnlp; char **defaultEs; + if (pledge("stdio rpath wpath cpath", NULL) == -1) + err(1, NULL); + --argc; argv++; debug = 0; @@ -129,6 +132,10 @@ main(int argc, char *argv[]) } else { gmonname = GMONNAME; } + if ( sflag == FALSE ) { + if (pledge("stdio rpath", NULL) == -1) + err(1, "pledge"); + } /* * get information about a.out file. */ diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index f9288f3c480..6ae47c822e0 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -1,4 +1,4 @@ -/* $OpenBSD: gprof.h,v 1.14 2013/10/19 13:51:40 deraadt Exp $ */ +/* $OpenBSD: gprof.h,v 1.15 2015/11/16 17:43:17 pascal Exp $ */ /* $NetBSD: gprof.h,v 1.13 1996/04/01 21:54:06 mark Exp $ */ /* @@ -40,6 +40,7 @@ #include <stdio.h> #include <stdlib.h> #include <err.h> +#include <unistd.h> #include MD_INCLUDE |