]> git.proxmox.com Git - mirror_lxc.git/commitdiff
Don't attempt to symlink kmsg without rootfs->path
authorDwight Engen <dwight.engen@oracle.com>
Tue, 11 Dec 2012 17:39:16 +0000 (12:39 -0500)
committerStéphane Graber <stgraber@ubuntu.com>
Tue, 11 Dec 2012 20:29:39 +0000 (15:29 -0500)
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 <dwight.engen@oracle.com>
Acked-by: Serge E. Hallyn <serge.hallyn@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/conf.c

index 7e44c3ce3e54b14a73bf2d50972f6f58b69f81c1..84e51db1b84a5b86690d84f81314398861329c24 100644 (file)
@@ -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;