add OpenBSD pledge(2) support using -DUSE_PLEDGE

This commit is contained in:
Hiltjo Posthuma
2016-05-03 00:33:56 +02:00
parent eae9437f94
commit aa36e0c9b4
3 changed files with 29 additions and 3 deletions

View File

@@ -23,6 +23,14 @@ static char description[255] = "Repositories";
static char *name = "";
static char owner[255];
#ifndef USE_PLEDGE
int
pledge(const char *promises, const char *paths[])
{
return 0;
}
#endif
/* Escape characters below as HTML 2.0 / XML 1.0. */
void
xmlencode(FILE *fp, const char *s, size_t len)
@@ -154,6 +162,9 @@ main(int argc, char *argv[])
char path[PATH_MAX], repodirabs[PATH_MAX + 1];
int i, ret = 0;
if (pledge("stdio rpath", NULL) == -1)
err(1, "pledge");
if (argc < 2) {
fprintf(stderr, "%s [repodir...]\n", argv[0]);
return 1;