[libvirt] [sandbox 3/3] Create /dev/fd symlink to /proc/self/fd

Cédric Bosdonnat cbosdonnat at suse.com
Mon Aug 24 10:17:06 UTC 2015


Some applications and scripts are using /dev/fd. Netconfig and
openSUSE network scripts are in such a case, getting the symlink makes
them work.
---
 libvirt-sandbox/libvirt-sandbox-init-qemu.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libvirt-sandbox/libvirt-sandbox-init-qemu.c b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
index cd6055a..5ecc3de 100644
--- a/libvirt-sandbox/libvirt-sandbox-init-qemu.c
+++ b/libvirt-sandbox/libvirt-sandbox-init-qemu.c
@@ -356,6 +356,12 @@ main(int argc ATTR_UNUSED, char **argv ATTR_UNUSED)
 
     /* Main special filesystems */
     mount_other("/dev", "devtmpfs", 0755);
+    if (symlink("/proc/self/fd", "/dev/fd") < 0) {
+        fprintf(stderr, "libvirt-sandbox-init-qemu: %s: failed to create /dev/fd symlink: %s\n",
+                __func__, strerror(errno));
+        exit_poweroff();
+    }
+
     mount_other_opts("/dev/pts", "devpts", "gid=5,mode=620,ptmxmode=000", 0755);
     mount_other("/sys", "sysfs", 0755);
     mount_other("/proc", "proc", 0755);
-- 
2.1.4




More information about the libvir-list mailing list