Commit eb6600df992a05d6bfd1e3c07ee2d18427cb6286

Stefan Sperling 2019-01-04T17:40:37

apply unveil(2) to 'tog diff'

diff --git a/tog/tog.c b/tog/tog.c
index 461e5d1..842187b 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -2112,8 +2112,8 @@ cmd_diff(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
 
@@ -2145,6 +2145,10 @@ cmd_diff(int argc, char *argv[])
 	} else
 		usage_diff();
 
+	error = apply_unveil(repo_path, NULL);
+	if (error)
+		goto done;
+
 	error = got_repo_open(&repo, repo_path);
 	free(repo_path);
 	if (error)