Fix x11 socket directory by setting umask
This commit is contained in:
parent
3dabe69881
commit
7b377d282e
@ -1,5 +1,5 @@
|
||||
use std::fs;
|
||||
use crate::{Error, sys, warn};
|
||||
use crate::{Error, sys};
|
||||
use crate::error::Result;
|
||||
use std::path::Path;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
use crate::{Error, Result, Logger, LogLevel, netlink};
|
||||
use crate::{Error, Result, Logger, LogLevel, netlink, sys};
|
||||
use crate::cmdline::CmdLine;
|
||||
use crate::sys::{sethostname, setsid, set_controlling_tty, mount_devtmpfs, mount_tmpfs, mkdir, umount, mount_sysfs, mount_procfs, mount_devpts, chown, chmod, create_directories, mount_overlay, move_mount, pivot_root, mount_9p, mount, waitpid, reboot, getpid, mount_tmpdir, mount_cgroup, mkdir_mode, umask, _chown};
|
||||
use crate::sys::{sethostname, setsid, set_controlling_tty, mount_devtmpfs, mount_tmpfs, mkdir, umount, mount_sysfs, mount_procfs, mount_devpts, chown, chmod, create_directories, mount_overlay, move_mount, pivot_root, mount_9p, mount, waitpid, reboot, getpid, mount_tmpdir, mount_cgroup, umask, _chown};
|
||||
use std::path::Path;
|
||||
use std::{fs, process, io, env};
|
||||
use crate::service::{Service, ServiceLaunch};
|
||||
@ -90,6 +90,7 @@ impl InitServer {
|
||||
}
|
||||
|
||||
pub fn setup_filesystem(&self) -> Result<()> {
|
||||
sys::set_umask(0o022);
|
||||
//mount_devtmpfs()?;
|
||||
mount_tmpfs("/tmp")?;
|
||||
mkdir("/tmp/sysroot")?;
|
||||
@ -223,7 +224,8 @@ impl InitServer {
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
mkdir_mode("/tmp/.X11-unix", 0o1777)?;
|
||||
mkdir("/tmp/.X11-unix")?;
|
||||
chmod("/tmp/.X11-unix", 0o1777)?;
|
||||
self.write_xauth().map_err(Error::XAuthFail)?;
|
||||
|
||||
let sommelierx = ServiceLaunch::new("sommelier-x", "/opt/ph/usr/bin/sommelier")
|
||||
@ -249,6 +251,7 @@ impl InitServer {
|
||||
self.configure_network(ip)
|
||||
.map_err(Error::NetworkConfigure)?;
|
||||
}
|
||||
sys::bind_mount("/opt/ph/etc/resolv.conf", "/etc/resolv.conf")?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
@ -7,6 +7,11 @@ use crate::error::{Result,Error};
|
||||
use libc;
|
||||
use std::path::Path;
|
||||
|
||||
pub fn set_umask(mode: u32) {
|
||||
unsafe {
|
||||
let _ = libc::umask(mode);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mount_tmpfs(target: &str) -> Result<()> {
|
||||
mount("tmpfs", target, "tmpfs", 0, Some("mode=755"))
|
||||
|
Loading…
Reference in New Issue
Block a user