fix(server): set sticky bit on socket files (#2141)
This commit is contained in:
parent
3973873252
commit
778d57c3c3
1 changed files with 4 additions and 1 deletions
|
|
@ -278,7 +278,10 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) {
|
||||||
move || {
|
move || {
|
||||||
drop(std::fs::remove_file(&socket_path));
|
drop(std::fs::remove_file(&socket_path));
|
||||||
let listener = LocalSocketListener::bind(&*socket_path).unwrap();
|
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() {
|
for stream in listener.incoming() {
|
||||||
match stream {
|
match stream {
|
||||||
Ok(stream) => {
|
Ok(stream) => {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue