From b88ff9a0e33e7220d0c2b7059706c492200e4c2b Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Graber?= Date: Mon, 2 Feb 2015 11:21:20 +0200 Subject: [PATCH] In lxc.mount.auto, skip on ENONENT MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This resolves the case where /proc/sysrq-trigger doesn't exist by simply ignoring any mount failure on ENOENT. With the current mount list, this will always result in a safe environment (typically the read-only underlay). Closes #425 v2: Don't always show an error Signed-off-by: Stéphane Graber Acked-by: Serge E. Hallyn --- src/lxc/conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index dc497e72b..286870861 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -800,7 +800,11 @@ static int lxc_mount_auto_mounts(struct lxc_conf *conf, int flags, struct lxc_ha default_mounts[i].flags); r = mount(source, destination, default_mounts[i].fstype, mflags, default_mounts[i].options); saved_errno = errno; - if (r < 0) + if (r < 0 && errno == ENOENT) { + INFO("Mount source or target for %s on %s doesn't exist. Skipping.", source, destination); + r = 0; + } + else if (r < 0) SYSERROR("error mounting %s on %s flags %lu", source, destination, mflags); free(source); -- 2.47.2