fix: XDG_SESSION_ID may contain non-numerical characters
This commit is contained in:
parent
116ef79931
commit
b93acffd87
1 changed files with 1 additions and 8 deletions
|
|
@ -35,14 +35,7 @@ use wayland_client::{protocol::wl_output::WlOutput, Proxy};
|
||||||
|
|
||||||
fn lockfile_opt() -> Option<PathBuf> {
|
fn lockfile_opt() -> Option<PathBuf> {
|
||||||
let runtime_dir = dirs::runtime_dir()?;
|
let runtime_dir = dirs::runtime_dir()?;
|
||||||
let session_id_str = env::var("XDG_SESSION_ID").ok()?;
|
let session_id = env::var("XDG_SESSION_ID").ok()?;
|
||||||
let session_id = match session_id_str.parse::<u64>() {
|
|
||||||
Ok(ok) => ok,
|
|
||||||
Err(err) => {
|
|
||||||
log::warn!("failed to parse session ID {:?}: {}", session_id_str, err);
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
Some(runtime_dir.join(format!("cosmic-greeter-{}.lock", session_id)))
|
Some(runtime_dir.join(format!("cosmic-greeter-{}.lock", session_id)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue