summaryrefslogtreecommitdiff
path: root/usr.bin/gprof
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
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')
-rw-r--r--usr.bin/gprof/gprof.c9
-rw-r--r--usr.bin/gprof/gprof.h3
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