make libgcgi compile on Linux add macros for unveil and pledge for systems that don not have it. - libgcgi - REST library for Gopher
(HTM) git clone git://bitreich.org/libgcgi git://hg6vgqziawt5s4dj.onion/libgcgi
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) README
(DIR) LICENSE
---
(DIR) commit cd632cd80d1400eced74e91a2dad416dbe0c01c2
(DIR) parent 2448c0d37ce7001aae8b49484d9fe08ff5573665
(HTM) Author: Christoph Lohmann <20h@r-36.net>
Date: Sat, 30 Jul 2022 13:08:13 +0200
make libgcgi compile on Linux
add macros for unveil and pledge for systems that don not have it.
Diffstat:
M index.c | 7 +++++++
1 file changed, 7 insertions(+), 0 deletions(-)
---
(DIR) diff --git a/index.c b/index.c
@@ -8,8 +8,14 @@
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
+
#include "libgcgi.h"
+#ifndef __OpenBSD__
+#define pledge(p1,p2) 0
+#define unveil(p1,p2) 0
+#endif
+
static void
error_404(char **matches)
{
@@ -33,6 +39,7 @@ static struct gcgi_handler handlers[] = {
int
main(int argc, char **argv)
{
+
/* restrict allowed paths */
unveil("gph", "r");
unveil("db", "rwc");