From bf262cba16c8ce2e846f0ba4cf094ecd38a87523 Mon Sep 17 00:00:00 2001 From: Ollie Agent Date: Tue, 18 Aug 2026 13:31:52 +0200 Subject: [PATCH] manage namespace directory lifecycle --- cmd/olliesrv/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cmd/olliesrv/main.go b/cmd/olliesrv/main.go index 647c752..f0da0fc 100644 --- a/cmd/olliesrv/main.go +++ b/cmd/olliesrv/main.go @@ -34,6 +34,10 @@ func main() { fmt.Fprintln(os.Stderr, "no namespace") os.Exit(1) } + if err := os.MkdirAll(ns, 0700); err != nil { + fmt.Fprintf(os.Stderr, "create namespace: %v\n", err) + os.Exit(1) + } sockPath := filepath.Join(ns, serviceName) runServer(sockPath) @@ -149,5 +153,9 @@ func runServer(sockPath string) { srv.Kill() } os.Remove(sockPath) + // Remove only an empty namespace directory. A plumber or another Plan 9 + // service may own other entries here; os.Remove never removes non-empty + // directories, so those entries are left untouched. + _ = os.Remove(filepath.Dir(sockPath)) sink.Flush() }