From f3a487cd410e95cfa25fc04bd5305e8de72b13f7 Mon Sep 17 00:00:00 2001 From: "fupan.lfp" Date: Thu, 24 Sep 2020 17:48:53 +0800 Subject: [PATCH] rustjail: make the mount error info much more clear Make the invalid mount destination's error info much more clear. Signed-off-by: fupan.lfp --- src/agent/rustjail/src/mount.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/agent/rustjail/src/mount.rs b/src/agent/rustjail/src/mount.rs index 8bc3152da..4f43ae180 100644 --- a/src/agent/rustjail/src/mount.rs +++ b/src/agent/rustjail/src/mount.rs @@ -176,7 +176,10 @@ pub fn init_rootfs( for m in &spec.mounts { let (mut flags, data) = parse_mount(&m); if !m.destination.starts_with("/") || m.destination.contains("..") { - return Err(anyhow!(nix::Error::Sys(Errno::EINVAL))); + return Err(anyhow!( + "the mount destination {} is invalid", + m.destination + )); } if m.r#type == "cgroup" { mount_cgroups(cfd_log, &m, rootfs, flags, &data, cpath, mounts)?;