From b2490958e9d66b1bc83845daec043fc28dab8680 Mon Sep 17 00:00:00 2001 From: espie Date: Sun, 11 Oct 2015 23:01:32 +0000 Subject: [PATCH] now that tsort has a clean structure, do more specific pledge() calls. okay deraadt@ --- usr.bin/tsort/tsort.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/usr.bin/tsort/tsort.c b/usr.bin/tsort/tsort.c index 4f25618ae68..e82841d7e85 100644 --- a/usr.bin/tsort/tsort.c +++ b/usr.bin/tsort/tsort.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tsort.c,v 1.31 2015/10/11 17:39:50 espie Exp $ */ +/* $OpenBSD: tsort.c,v 1.32 2015/10/11 23:01:32 espie Exp $ */ /* ex:ts=8 sw=4: * * Copyright (c) 1999-2004 Marc Espie @@ -824,7 +824,7 @@ parse_args(int argc, char *argv[], struct ohash *pairs) int c; unsigned int order; int reverse_flag; - char **files; + const char **files; int i, j; i = 0; @@ -878,6 +878,9 @@ parse_args(int argc, char *argv[], struct ohash *pairs) files[i] = NULL; + if (pledge("stdio rpath", files) == -1) + err(1, "pledge"); + nodes_init(pairs); order = 0; @@ -905,6 +908,9 @@ parse_args(int argc, char *argv[], struct ohash *pairs) order = read_pairs(stdin, pairs, reverse_flag, "stdin", order, hints_flag == 2); } + + if (pledge("stdio", NULL) == -1) + err(1, "pledge"); } static int -- 2.20.1