Kay Sievers wrote: > On Tue, Sep 16, 2008 at 7:16 PM, Kay Sievers <kay.sievers@xxxxxxxx> wrote: > >> On Tue, Sep 16, 2008 at 03:09, Alan Jenkins <alan-jenkins@xxxxxxxxxxxxxx> wrote: >> >>> commit 8753fadf2a6ecead372e71b8bf9336cf29f9c958 >>> >>> Lots of the udev tests fail here. udev_sysfs.c broke when >>> util_resolve_sys_link() switched API. >>> >> Ah, sorry, should be fixed now. >> >> >>> I'll leave this up to you - maybe >>> your next commit is going to do away with udev_sysfs.c altogether :-). >>> >> It will go away soon, yeah. We should get rid of udev_sysfs.c and >> "struct udevice". >> > > Along with a lot of other stuff, udev_sysfs.c is gone. Also the global > event environment is replaced by a per-device property list. The > daemon, and everything else uses the libudev code now. > > It seems to work fine here, but the code may be a bit rough at the > moment, until it has seen more testing. But, it should be pretty easy > now to play around with a threaded version of the daemon. > > Thanks, > Kay > # valgrind -q ./udevd & # udevtrigger ==16329== Invalid read of size 1 ==16329== at 0x40C9DA: udev_device_set_syspath (libudev-device.c:939) ==16329== by 0x40DFB6: udev_monitor_receive_device (libudev-monitor.c:318) ==16329== by 0x411F52: main (udevd.c:889) ==16329== Address 0x60f2507 is 1 bytes before a block of size 6 alloc'd ==16329== at 0x4C22FAB: malloc (vg_replace_malloc.c:207) ==16329== by 0x4EA1DD1: strdup (strdup.c:43) ==16329== by 0x40C987: udev_device_set_syspath (libudev-device.c:926) ==16329== by 0x40DFB6: udev_monitor_receive_device (libudev-monitor.c:318) ==16329== by 0x411F52: main (udevd.c:889) The syspath in question was /sys/kernel/uids/65534. Try this? diff --git a/udev/lib/libudev-device.c b/udev/lib/libudev-device.c index 65ba6e3..dd08439 100644 --- a/udev/lib/libudev-device.c +++ b/udev/lib/libudev-device.c @@ -936,8 +936,13 @@ int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath } /* trailing number */ - while (isdigit(udev_device->sysname[--len])) + while (len > 0 && isdigit(udev_device->sysname[--len])) udev_device->sysnum = &udev_device->sysname[len]; + + /* oops, sysname is completely numeric */ + if (len == 0) + udev_device->sysnum = NULL; + return 0; } -- To unsubscribe from this list: send the line "unsubscribe linux-hotplug" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html