Merge pull request #183 from mahkoh/jorth/run-privileged
cli: make nested/out-of-jay run-privileged a no-op
This commit is contained in:
commit
0605438d56
2 changed files with 15 additions and 8 deletions
|
|
@ -46,7 +46,6 @@ struct AllocatedSocket {
|
||||||
lock_path: Ustring,
|
lock_path: Ustring,
|
||||||
_lock_fd: OwnedFd,
|
_lock_fd: OwnedFd,
|
||||||
// /run/user/1000/wayland-x.jay
|
// /run/user/1000/wayland-x.jay
|
||||||
#[cfg_attr(not(feature = "it"), allow(dead_code))]
|
|
||||||
secure_path: Ustring,
|
secure_path: Ustring,
|
||||||
secure: Rc<OwnedFd>,
|
secure: Rc<OwnedFd>,
|
||||||
}
|
}
|
||||||
|
|
@ -55,6 +54,7 @@ impl Drop for AllocatedSocket {
|
||||||
fn drop(&mut self) {
|
fn drop(&mut self) {
|
||||||
let _ = uapi::unlink(&self.path);
|
let _ = uapi::unlink(&self.path);
|
||||||
let _ = uapi::unlink(&self.lock_path);
|
let _ = uapi::unlink(&self.lock_path);
|
||||||
|
let _ = uapi::unlink(&self.secure_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,19 +3,26 @@ use {
|
||||||
cli::{GlobalArgs, RunPrivilegedArgs},
|
cli::{GlobalArgs, RunPrivilegedArgs},
|
||||||
compositor::WAYLAND_DISPLAY,
|
compositor::WAYLAND_DISPLAY,
|
||||||
logger::Logger,
|
logger::Logger,
|
||||||
utils::{errorfmt::ErrorFmt, oserror::OsError},
|
utils::{errorfmt::ErrorFmt, oserror::OsError, xrd::xrd},
|
||||||
},
|
},
|
||||||
|
std::path::PathBuf,
|
||||||
uapi::UstrPtr,
|
uapi::UstrPtr,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn main(global: GlobalArgs, args: RunPrivilegedArgs) {
|
pub fn main(global: GlobalArgs, args: RunPrivilegedArgs) {
|
||||||
Logger::install_stderr(global.log_level.into());
|
Logger::install_stderr(global.log_level.into());
|
||||||
let mut wd = match std::env::var(WAYLAND_DISPLAY) {
|
if let Some(xrd) = xrd() {
|
||||||
Ok(v) => v,
|
let mut wd = match std::env::var(WAYLAND_DISPLAY) {
|
||||||
_ => fatal!("{} is not set", WAYLAND_DISPLAY),
|
Ok(v) => v,
|
||||||
};
|
_ => fatal!("{} is not set", WAYLAND_DISPLAY),
|
||||||
wd.push_str(".jay");
|
};
|
||||||
std::env::set_var(WAYLAND_DISPLAY, &wd);
|
wd.push_str(".jay");
|
||||||
|
let mut path = PathBuf::from(xrd);
|
||||||
|
path.push(&wd);
|
||||||
|
if path.exists() {
|
||||||
|
std::env::set_var(WAYLAND_DISPLAY, &wd);
|
||||||
|
}
|
||||||
|
}
|
||||||
let mut argv = UstrPtr::new();
|
let mut argv = UstrPtr::new();
|
||||||
for arg in &args.program {
|
for arg in &args.program {
|
||||||
argv.push(arg.as_str());
|
argv.push(arg.as_str());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue