summaryrefslogtreecommitdiff
path: root/usr.bin/gprof/gprof.c
diff options
context:
space:
mode:
authorPascal Stumpf <pascal@cvs.openbsd.org>2015-11-16 17:43:18 +0000
committerPascal Stumpf <pascal@cvs.openbsd.org>2015-11-16 17:43:18 +0000
commit53c929289e47787c74fd964bc6cb65bc36e38068 (patch)
tree21c1e0a368051c803bfdc4dde04be9ccc7db843d /usr.bin/gprof/gprof.c
parent81c504a1cce80f46da360944a565f673b018fbfa (diff)
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@
Diffstat (limited to 'usr.bin/gprof/gprof.c')
-rw-r--r--usr.bin/gprof/gprof.c9
1 files changed, 8 insertions, 1 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.
*/