Check XDG_RUNTIME_DIR owner before creating session directory
This avoids an issue when using `su` and running Kakoune which creates a session directory owned by root and prevents the user from creating more sessions.
This commit is contained in:
parent
b8f1df6458
commit
7751c7e188
|
@ -604,6 +604,10 @@ void make_session_directory()
|
||||||
// set sticky bit on the shared kakoune directory
|
// set sticky bit on the shared kakoune directory
|
||||||
make_directory(format("{}/kakoune", tmpdir()), 01777);
|
make_directory(format("{}/kakoune", tmpdir()), 01777);
|
||||||
}
|
}
|
||||||
|
else if (struct stat st;
|
||||||
|
stat(xdg_runtime_dir.zstr(), &st) == 0 && st.st_uid != geteuid())
|
||||||
|
throw runtime_error("XDG_RUNTIME_DIR is not owned by current user");
|
||||||
|
|
||||||
make_directory(session_directory(), 0711);
|
make_directory(session_directory(), 0711);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user