From 53c929289e47787c74fd964bc6cb65bc36e38068 Mon Sep 17 00:00:00 2001 From: Pascal Stumpf Date: Mon, 16 Nov 2015 17:43:18 +0000 Subject: 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@ --- usr.bin/gprof/gprof.c | 9 ++++++++- usr.bin/gprof/gprof.h | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'usr.bin/gprof') 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; @@ -128,6 +131,10 @@ main(int argc, char *argv[]) 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 #include #include +#include #include MD_INCLUDE -- cgit v1.2.3