Commit d188b9a6a4bf15b68454c779d7bdfe1d76c8e90e

Stefan Sperling 2019-01-04T17:42:43

apply unveil(2) to 'tog tree'

diff --git a/tog/tog.c b/tog/tog.c
index 1154cf1..0d1a957 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -3415,8 +3415,8 @@ cmd_tree(int argc, char *argv[])
 	struct tog_view *view;
 
 #ifndef PROFILE
-	if (pledge("stdio rpath wpath cpath flock proc tty exec sendfd", NULL)
-	    == -1)
+	if (pledge("stdio rpath wpath cpath flock proc tty exec sendfd unveil",
+	    NULL) == -1)
 		err(1, "pledge");
 #endif
 
@@ -3445,6 +3445,10 @@ cmd_tree(int argc, char *argv[])
 	} else
 		usage_log();
 
+	error = apply_unveil(repo_path, NULL);
+	if (error)
+		return error;
+
 	error = got_repo_open(&repo, repo_path);
 	free(repo_path);
 	if (error != NULL)