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

Daniel P. Berrange berrange at redhat.com
Wed May 6 10:31:12 UTC 2009


On Wed, May 06, 2009 at 04:01:32AM +0900, Ryota Ozaki wrote:
> 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.

Wierd. I guess no one has anything that uses this  becasue current
code is clearly useless / broken.

ACK

Daniel
> 
> >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
> 
> --
> Libvir-list mailing list
> Libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|




More information about the libvir-list mailing list