From 222fea5a10544018f26d60d73132069fb0fa8797 Mon Sep 17 00:00:00 2001 From: Dwight Engen Date: Tue, 11 Dec 2012 12:39:16 -0500 Subject: [PATCH] Don't attempt to symlink kmsg without rootfs->path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit For example doing "lxc-execute -n tmpct /bin/bash" will call setup_kmsg(), but in this case rootfs->mount/dev directory doesn't even exist so the call to symlink fails with ENOENT. Commit f62b3449 made this failure not fatal, but we should not even try it when we know it will fail. See similar code in setup_tty(), setup_console(), etc. Signed-off-by: Dwight Engen Acked-by: Serge E. Hallyn Acked-by: Stéphane Graber --- src/lxc/conf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/lxc/conf.c b/src/lxc/conf.c index 7e44c3ce3..84e51db1b 100644 --- a/src/lxc/conf.c +++ b/src/lxc/conf.c @@ -1204,6 +1204,8 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs, char kpath[MAXPATHLEN]; int ret; + if (!rootfs->path) + return 0; ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount); if (ret < 0 || ret >= sizeof(kpath)) return -1; -- 2.39.5