summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/serve.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/serve.c b/src/serve.c
index a3ac81a..11a34f2 100644
--- a/src/serve.c
+++ b/src/serve.c
@@ -145,6 +145,10 @@ serve_cgi(struct gmnisrv_client *client, const char *path,
dup2(pfd[1], STDOUT_FILENO);
close(pfd[1]);
+ char cwd[PATH_MAX + 1];
+ strcpy(cwd, path);
+ chdir(dirname(cwd));
+
// I don't feel like freeing this stuff and this process is
// going to die soon anyway so let's just be hip and call it an
// arena allocator :^)