turn index.c into something suitable for an exapmle - 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 5bc5afc6bfca4948fee87a59a87aede28f2de765
(DIR) parent 875d6f5a34f5592631c24949f612194ba7d626e6
(HTM) Author: Josuah Demangeon <me@josuah.net>
Date: Sat, 30 Jul 2022 13:24:21 +0200
turn index.c into something suitable for an exapmle
Diffstat:
M index.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/index.c b/index.c
@@ -41,11 +41,12 @@ main(int argc, char **argv)
{
/* restrict allowed paths */
- unveil("gph", "r");
- unveil("db", "rwc");
+ if (unveil("gph", "r") == -1 || unveil("db", "rwc") == -1)
+ gcgi_fatal("unveil failed");
/* restrict allowed system calls */
- pledge("stdio rpath wpath cpath", NULL);
+ if (pledge("stdio rpath wpath cpath", NULL) == -1)
+ gcgi_fatal("pledge failed");
/* handle the request with the handlers */
gcgi_handle_request(handlers, argv, argc);