From 217dee64bba2c2851d2d46e5194d5ed58782c79d Mon Sep 17 00:00:00 2001
From: Ophestra Umiker <cat@ophivana.moe>
Date: Thu, 17 Oct 2024 02:22:38 +0900
Subject: [PATCH] feat: make socket world accessible

This socket is typically placed in a directory with restrictive permissions, and that is a much easier way to control access than to have the application set it to some custom value.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
---
 app.go | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/app.go b/app.go
index 83af946..cc4f32f 100644
--- a/app.go
+++ b/app.go
@@ -80,6 +80,9 @@ func serve(sig chan os.Signal, db *leveldb.DB) error {
 		if l, err := net.Listen("unix", conf[listen]); err != nil {
 			return err
 		} else {
+			if err = os.Chmod(conf[listen], 0777); err != nil {
+				log.Printf("cannot change ownership of socket %q: %v", conf[listen], err)
+			}
 			return app.Listener(l)
 		}
 	}
-- 
GitLab