On Thursday 13 November 2008 18:55:31 Doug Graham wrote:
> On Thu, Nov 13, 2008 at 06:48:41PM -0600, Rob Landley wrote:
> > On Thursday 13 November 2008 13:35:57 Doug Graham wrote:
> > > This is probably the wrong mailing list to report this bug to, but it's
> > > the one I subscribe to, and this bug is relevant to this list, so you
> > > might be interested.
> > >
> > > uClibc's mknod implementation looks like this:
> >
> > Not only a report to the wrong list, but no mention of which version you
> > encountered the problem in (when said project had a new release
> > _yesterday_).
>
> Well, I shouldn't think it would be too hard to check the latest release
> to see if this bug still exists, but you're right, I should have mentioned
> which release I was looking at.  It was uClibc-0.9.30 (today's release).

Ok, worth taking 15 minutes to look at then.

mknod.c is getting major() and minor() macros out of include/sys/sysmacros.h, 
where major() minor() and makedev() are redirected to gnu_dev_*, which is 
insane for 3 reasons:

1) What does gnu have to do with anything?  We're making a linux kernel 
syscall.
2) It's messing around with 64 bit numbers, but kdev_t is a 32 bit number.  
(The whole << 32 bit is just bloat that's going to get chopped off, as is the 
gratuitous conversion to long long on 32 bit platforms.)
3) In this case, dev_t and kdev_t should be in exactly the same format, so if 
it was working _correctly_ the translation would be a NOP.

Possibly the attached patch?

Rob
Index: libc/sysdeps/linux/common/mknod.c
===================================================================
--- libc/sysdeps/linux/common/mknod.c	(revision 24035)
+++ libc/sysdeps/linux/common/mknod.c	(working copy)
@@ -19,10 +19,6 @@
 
 int mknod(const char *path, mode_t mode, dev_t dev)
 {
-	/* We must convert the dev_t value to a __kernel_dev_t */
-	__kernel_dev_t k_dev;
-
-	k_dev = ((major(dev) & 0xff) << 8) | (minor(dev) & 0xff);
-	return __syscall_mknod(path, mode, k_dev);
+	return __syscall_mknod(path, mode, (__kernel_dev_t)dev);
 }
 libc_hidden_def(mknod)
_______________________________________________
uClibc mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/uclibc

Reply via email to