summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgreg@kroah.com <greg@kroah.com>2003-08-04 21:20:19 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 21:01:40 -0700
commitea256f901e30927591874ee3eb5b92e1ce5a5db1 (patch)
tree1df19835d772976ecfa21b3b5ea0e9f432adc1ed
parent[PATCH] oops, everything was getting created as 000 mode, try to fix this up, (diff)
downloadsystemd-ea256f901e30927591874ee3eb5b92e1ce5a5db1.tar.gz
systemd-ea256f901e30927591874ee3eb5b92e1ce5a5db1.tar.bz2
systemd-ea256f901e30927591874ee3eb5b92e1ce5a5db1.zip
[PATCH] handle new major:minor format of dev files that showed up in 2.6.0-test2-bk3 or so.
-rw-r--r--udev-add.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/udev-add.c b/udev-add.c
index 45ffbf81b..54af7e4d7 100644
--- a/udev-add.c
+++ b/udev-add.c
@@ -49,30 +49,23 @@ static char sysfs_path[SYSFS_PATH_MAX];
*/
static int get_major_minor(struct sysfs_class_device *class_dev, int *major, int *minor)
{
- char temp[3];
- int retval = 0;
+ int retval = -ENODEV;
char *dev;
dev = sysfs_get_value_from_attributes(class_dev->directory->attributes, "dev");
if (dev == NULL)
- return -ENODEV;
+ goto exit;
dbg("dev = %s", dev);
- temp[0] = dev[0];
- temp[1] = dev[1];
- temp[2] = 0x00;
- *major = (int)strtol(&temp[0], NULL, 16);
-
- temp[0] = dev[2];
- temp[1] = dev[3];
- temp[2] = 0x00;
- *minor = (int)strtol(&temp[0], NULL, 16);
+ if (sscanf(dev, "%u:%u", major, minor) != 2)
+ goto exit;
dbg("found major = %d, minor = %d", *major, *minor);
retval = 0;
+exit:
return retval;
}