X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;ds=sidebyside;f=udev%2Fudev_rules.c;h=4719cab5b8e7fe2613f54172b73e83a9fafc07f4;hb=cf8ec631a23eae532541bfeeccce20f0d978404d;hp=ea850a84c339a90712ff89c792b8d987b3ba1322;hpb=726687ad48bdececed1e7e44387c50e009e28208;p=elogind.git diff --git a/udev/udev_rules.c b/udev/udev_rules.c index ea850a84c..4719cab5b 100644 --- a/udev/udev_rules.c +++ b/udev/udev_rules.c @@ -174,7 +174,7 @@ static int run_program(const char *command, const char *subsystem, /* allow programs in /lib/udev called without the path */ if (strchr(argv[0], '/') == NULL) { - strlcpy(program, "/lib/udev/", sizeof(program)); + strlcpy(program, UDEV_PREFIX "/lib/udev/", sizeof(program)); strlcat(program, argv[0], sizeof(program)); argv[0] = program; } @@ -424,7 +424,7 @@ static int import_parent_into_env(struct udevice *udev, const char *filter) struct name_entry *name_loop; dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); + udev_parent = udev_device_init(); if (udev_parent == NULL) return -1; /* import the udev_db of the parent */ @@ -569,27 +569,29 @@ static int wait_for_file(struct udevice *udev, const char *file, int timeout) static int attr_get_by_subsys_id(const char *attrstr, char *devpath, size_t len, char **attr) { char subsys[NAME_SIZE]; - char *attrib; + char *pos; char *id; + char *attrib; int found = 0; if (attrstr[0] != '[') goto out; - strlcpy(subsys, &attrstr[1], sizeof(subsys)); - - attrib = strchr(subsys, ']'); + attrib = strchr(&attrstr[1], ']'); if (attrib == NULL) goto out; - attrib[0] = '\0'; attrib = &attrib[1]; + strlcpy(subsys, &attrstr[1], sizeof(subsys)); + pos = strchr(subsys, ']'); + if (pos == NULL) + goto out; + pos[0] = '\0'; id = strchr(subsys, '/'); if (id == NULL) goto out; id[0] = '\0'; id = &id[1]; - if (sysfs_lookup_devpath_by_subsys_id(devpath, len, subsys, id)) { if (attr != NULL) { if (attrib[0] != '\0') @@ -881,7 +883,7 @@ found: struct udevice *udev_parent; dbg("found parent '%s', get the node name\n", dev_parent->devpath); - udev_parent = udev_device_init(NULL); + udev_parent = udev_device_init(); if (udev_parent != NULL) { /* lookup the name in the udev_db with the DEVPATH of the parent */ if (udev_db_get_device(udev_parent, dev_parent->devpath) == 0) {