SecBSD's official ports repository

This commit is contained in:
purplerain 2023-08-16 22:26:55 +00:00
commit 2c0afcbbf3
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
64331 changed files with 5339189 additions and 0 deletions

View file

@ -0,0 +1,31 @@
add pledge(2) and unveil(2) to codebrowser_generator
Index: generator/main.cpp
--- generator/main.cpp.orig
+++ generator/main.cpp
@@ -43,6 +43,8 @@
#include "compat.h"
#include <ctime>
+#include <unistd.h>
+
#include "embedded_includes.h"
namespace cl = llvm::cl;
@@ -325,6 +327,16 @@ int main(int argc, const char **argv) {
}
llvm::cl::ParseCommandLineOptions(argc, argv);
+
+ create_directories(OutputPath);
+ if ((unveil(OutputPath.c_str(), "rwc") == -1) || (unveil("/", "r") == -1)) {
+ std::cerr << "error: unveil" << std::endl;
+ return EXIT_FAILURE;
+ }
+ if (pledge("stdio rpath wpath cpath tty", "") == -1) {
+ std::cerr << "error: pledge" << std::endl;
+ return EXIT_FAILURE;
+ }
#ifdef _WIN32
make_forward_slashes(OutputPath._Get_data()._Myptr());

View file

@ -0,0 +1,29 @@
add pledge(2) and unveil(2) to codebrowser_indexgenerator.
Index: indexgenerator/indexer.cpp
--- indexgenerator/indexer.cpp.orig
+++ indexgenerator/indexer.cpp
@@ -28,6 +28,8 @@
#include <map>
#include <ctime>
+#include <unistd.h>
+
#include "../global.h"
const char *data_url = "../data";
@@ -228,6 +230,14 @@ int main(int argc, char **argv) {
if (root.empty()) {
std::cerr << "Usage: " << argv[0] << " <path> [-d data_url] [-p project_definition]" << std::endl;
return -1;
+ }
+ if ((unveil(root.c_str(), "rwc") == -1) || (unveil("/", "r") == -1)) {
+ std::cerr << "error: unveil" << std::endl;
+ return EXIT_FAILURE;
+ }
+ if (pledge("stdio rpath wpath cpath tty", "") == -1) {
+ std::cerr << "error: pledge" << std::endl;
+ return EXIT_FAILURE;
}
std::ifstream fileIndex(root + "/" + "fileIndex");
std::string line;