[libvirt] [PATCH] lxc: fix mknod file type

Ryota Ozaki ozaki.ryota at gmail.com
Tue May 5 19:01:32 UTC 2009


Hi,

This patch fixes the 2nd argument of mknod syscall. The argument
should include a file type, i.e., S_IFCHR in this case, otherwise
created files will be regular files.

Thanks,
  ozaki-r

Signed-off-by: Ryota Ozaki <ozaki.ryota at gmail.com>

>From 60009b725da855f131e8272f0397455ae27bafc3 Mon Sep 17 00:00:00 2001
From: Ryota Ozaki <ozaki.ryota at gmail.com>
Date: Wed, 6 May 2009 03:47:04 +0900
Subject: [PATCH] lxc: fix mknod file type

This patch fixes the 2nd argument of mknod syscall. The argument
should include a file type, i.e., S_IFCHR in this case, otherwise
created files will be regular files.
---
 src/lxc_container.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/lxc_container.c b/src/lxc_container.c
index 3946b84..c30daec 100644
--- a/src/lxc_container.c
+++ b/src/lxc_container.c
@@ -440,7 +440,7 @@ static int lxcContainerPopulateDevices(void)
     /* Populate /dev/ with a few important bits */
     for (i = 0 ; i < ARRAY_CARDINALITY(devs) ; i++) {
         dev_t dev = makedev(devs[i].maj, devs[i].min);
-        if (mknod(devs[i].path, 0, dev) < 0 ||
+        if (mknod(devs[i].path, S_IFCHR, dev) < 0 ||
             chmod(devs[i].path, devs[i].mode)) {
             virReportSystemError(NULL, errno,
                                  _("failed to make device %s"),
@@ -457,7 +457,7 @@ static int lxcContainerPopulateDevices(void)
         }
     } else {
         dev_t dev = makedev(LXC_DEV_MAJ_TTY, LXC_DEV_MIN_PTMX);
-        if (mknod("/dev/ptmx", 0, dev) < 0 ||
+        if (mknod("/dev/ptmx", S_IFCHR, dev) < 0 ||
             chmod("/dev/ptmx", 0666)) {
             virReportSystemError(NULL, errno, "%s",
                                  _("failed to make device /dev/ptmx"));
-- 
1.6.0.6




More information about the libvir-list mailing list