incorrectly placed sysfs_init() call in udevtest
PATCH 1/1 incorrectly placed sysfs_init() call in udevtest
The udevtest documentation doesn't make this explicitly clear, but udevtest should treat device paths in the same way as udevinfo: it should strip the leading /sys (or whatever sysfs_path is) if given. In fact, there is code in udevtest.c designed to do just this.
However, sysfs_init() is called _after_ this code, which uses sysfs_path. So, at the time it checks whether sysfs_path is at the front of the device path, sysfs_path is an empty string. As a result, the command
udevtest /sys/block/hda
fails with the message
main: unable to open '/sys/block/hda'
while
udevtest /block/hda
produces the expected output (assuming you have at least one ide drive).
The attached patch moves sysfs_init() to the same place as udev_init(), and before the code that uses sysfs_path.
Diff against udev-097.
Alex :-)
Signature · 3 lines
Pippin Computer Monkey to the Pelican www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk
udevtest.c +1 -1
@@ -64,6 +64,7 @@udev_config_init ();if (udev_log_priority <LOG_INFO ) udev_log_priority =LOG_INFO ; +sysfs_init ();if (argc !=2 ) {info ("Usage: udevtest <devpath>" );
@@ -82,7 +83,6 @@ }else devpath = argv[1 ]; -sysfs_init ();udev_rules_init (&rules,0 ); dev =sysfs_device_get (devpath);
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Kay Sievers
AppliedQuoted 16 lines · Alex Merry
The udevtest documentation doesn't make this explicitly clear, but udevtest should treat device paths in the same way as udevinfo: it should strip the leading /sys (or whatever
sysfs_pathis) if given. In fact, there is code inudevtest.cdesigned to do just this.However,
sysfs_init()is called _after_ this code, which usessysfs_path. So, at the time it checks whethersysfs_pathis at the front of the device path,sysfs_pathis an empty string. As a result, the command
udevtest/sys/block/hda
fails with the message
main: unable to open '/sys/block/hda'
while
udevtest /block/hda
produces the expected output (assuming you have at least one ide drive).
Quoted 4 lines
The attached patch moves
sysfs_init()to the same place asudev_init(), and before the code that usessysfs_path.Diff against udev-097.
Applied.
Thanks,
Kay
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0709&bid&3057&dat1642
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel