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:
parent
17f52e31ca
commit
6a1c59f91a
2 changed files with 1 additions and 6 deletions
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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))?;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue