diff options
author | Thomas Linford <tlinford@users.noreply.github.com> | 2023-04-05 17:36:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-05 17:36:47 +0200 |
commit | 778d57c3c300c006e948b8e2d95182777b44cee0 (patch) | |
tree | cf06b3d5476a06480ddedfb6f8d627a851b5b516 | |
parent | 3973873252d3c5f2b93a7a23936936af6c0a15b4 (diff) |
fix(server): set sticky bit on socket files (#2141)
-rw-r--r-- | zellij-server/src/lib.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 34c807f16..bb18912ea 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -278,7 +278,10 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { move || { drop(std::fs::remove_file(&socket_path)); let listener = LocalSocketListener::bind(&*socket_path).unwrap(); - set_permissions(&socket_path, 0o700).unwrap(); + // set the sticky bit to avoid the socket file being potentially cleaned up + // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html states that for XDG_RUNTIME_DIR: + // "To ensure that your files are not removed, they should have their access time timestamp modified at least once every 6 hours of monotonic time or the 'sticky' bit should be set on the file. " + set_permissions(&socket_path, 0o1700).unwrap(); for stream in listener.incoming() { match stream { Ok(stream) => { |