about summary refs log tree commit diff stats
path: root/src/loader
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-16 18:35:22 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-16 18:58:13 +0200
commited84d7223fd8945705dcedd204fee137b249c524 (patch)
tree3539b9ccb5af2de6ad66e6d3362bff83abc1df88 /src/loader
parent87a5c636eb203cd066a620129f93c30b02245ad9 (diff)
downloadchawan-ed84d7223fd8945705dcedd204fee137b249c524.tar.gz
config: separate tmp dir for sockets, users
* add $LOGNAME to the tmp directory name, so that tmpdirs of separate
  users don't conflict
* use separate directory for sockets, so that we do not have to give
  buffers access to all cached pages
Diffstat (limited to 'src/loader')
-rw-r--r--src/loader/loader.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/loader/loader.nim b/src/loader/loader.nim
index 8c5fd5d5..c378523b 100644
--- a/src/loader/loader.nim
+++ b/src/loader/loader.nim
@@ -124,6 +124,7 @@ type
     uriMethodMap*: URIMethodMap
     w3mCGICompat*: bool
     tmpdir*: string
+    sockdir*: string
 
   LoaderClientConfig* = object
     cookieJar*: CookieJar
@@ -705,7 +706,7 @@ proc initLoaderContext(fd: cint; config: LoaderConfig): LoaderContext =
   gctx = ctx
   let myPid = getCurrentProcessId()
   # we don't capsicumize loader, so -1 is appropriate here
-  ctx.ssock = initServerSocket(config.tmpdir, -1, myPid, blocking = true)
+  ctx.ssock = initServerSocket(config.sockdir, -1, myPid, blocking = true)
   let sfd = int(ctx.ssock.sock.getFd())
   ctx.selector.registerHandle(sfd, {Read}, 0)
   # The server has been initialized, so the main process can resume execution.