Commit 222fea5a by Dwight Engen Committed by Stéphane Graber

Don't attempt to symlink kmsg without rootfs->path

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: 's avatarDwight Engen <dwight.engen@oracle.com> Acked-by: 's avatarSerge E. Hallyn <serge.hallyn@ubuntu.com> Acked-by: 's avatarStéphane Graber <stgraber@ubuntu.com>
parent 769872f9
...@@ -1204,6 +1204,8 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs, ...@@ -1204,6 +1204,8 @@ static int setup_kmsg(const struct lxc_rootfs *rootfs,
char kpath[MAXPATHLEN]; char kpath[MAXPATHLEN];
int ret; int ret;
if (!rootfs->path)
return 0;
ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount); ret = snprintf(kpath, sizeof(kpath), "%s/dev/kmsg", rootfs->mount);
if (ret < 0 || ret >= sizeof(kpath)) if (ret < 0 || ret >= sizeof(kpath))
return -1; return -1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment