[PATCH] mdev & running commands
Denys Vlasenko
vda.linux at googlemail.com
Mon Jan 12 07:58:56 UTC 2009
On Friday 09 January 2009 14:49, Marcin Juszkiewicz wrote:
> Hi
>
> I am using busybox 1.13.2 on my target devices. As I need fast boot I
> switched from udev to mdev. And here I found a problem.
>
> Mdev allows to move/symlink nodes into subdirs. It also allow to run
> commands for specified nodes. But if both options are needed then there
> is a small problem. My entry is:
>
> event.* 0:0 0660 =input/ @/etc/mdev/find-touchscreen.sh
>
> As I want event* nodes in /dev/input/ (like I had with udev) and need to
> know which of them is touchscreen. With 1.13.2 busybox all I got was
> "/dev/input/ @/etc/mdev/find-touchscreen.sh" node which really was
> event2...
>
> Patch below makes my rule works like I expect. Please review.
Patch makes mdev testsuite fail. This one works:
diff -d -urpN busybox.1/util-linux/mdev.c busybox.2/util-linux/mdev.c
--- busybox.1/util-linux/mdev.c 2008-12-30 06:03:15.000000000 +0100
+++ busybox.2/util-linux/mdev.c 2009-01-12 08:54:22.000000000 +0100
@@ -179,8 +179,9 @@ static void make_device(char *path, int
unsigned i, n;
#endif
char *a = val;
- s = strchr(val, ' ');
- val = (s && s[1]) ? s+1 : NULL;
+ s = strchrnul(val, ' ');
+ val = (s[0] && s[1]) ? s+1 : NULL;
+ s[0] = '\0';
#if ENABLE_FEATURE_MDEV_RENAME_REGEXP
/* substitute %1..9 with off[1..9], if any */
n = 0;
I added your example to testsuite, thanks.
--
vda
More information about the busybox
mailing list