Commit 25eccc22cd413b9a338870cc3ab376f146b4715f

Stefan Sperling 2019-01-04T17:34:41

apply unveil(2) to 'got diff'

diff --git a/got/got.c b/got/got.c
index 7be0a15..2bf611f 100644
--- a/got/got.c
+++ b/got/got.c
@@ -867,8 +867,8 @@ cmd_diff(int argc, char *argv[])
 	const char *errstr;
 
 #ifndef PROFILE
-	if (pledge("stdio rpath wpath cpath flock proc exec sendfd", NULL)
-	    == -1)
+	if (pledge("stdio rpath wpath cpath flock proc exec sendfd unveil",
+	    NULL) == -1)
 		err(1, "pledge");
 #endif
 
@@ -905,6 +905,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 != NULL)