fix socket permissions and ipc cleanup bug

- daemon: chmod socket to 0770 after bind so group devs can connect
- ipc: remove stale-socket deletion — it was deleting the socket when
  connect failed due to permissions, breaking the running daemon
This commit is contained in:
Niko Marmeladkov 2026-07-03 13:21:40 +03:00
parent 17f52e31ca
commit 6a1c59f91a
Signed by untrusted user who does not match committer: Niko
GPG key ID: E3B955F9442D44E3
2 changed files with 1 additions and 6 deletions

View file

@ -79,6 +79,7 @@ pub fn run(config_path: String) {
return;
}
};
let _ = fs::set_permissions(&sock_path, fs::Permissions::from_mode(0o770));
listener.set_nonblocking(true).ok();
let mut procs: HashMap<String, Proc> = HashMap::new();

View file

@ -4,12 +4,6 @@ use std::os::unix::net::UnixStream;
pub fn send_cmd(cmd: &str) -> Result<Vec<String>, String> {
let path = crate::state::socket_path();
if path.exists() {
if UnixStream::connect(&path).is_err() {
let _ = std::fs::remove_file(&path);
}
}
let mut stream = UnixStream::connect(&path).map_err(|e| format!("daemon not running: {}", e))?;
writeln!(stream, "{}", cmd).map_err(|e| format!("write: {}", e))?;
stream.flush().map_err(|e| format!("flush: {}", e))?;