X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=namedev.c;h=2f9d8f5f67b08892b55b86903a82edbd8ac00e22;hb=7b7e4df57ba0109d8c90db84b1663f5f25427ce1;hp=cd38f25cb0979541ad42e119734b2fdb61abaa35;hpb=a27cd06c6d3c83d9906f5e1aaf8d3c4b32055830;p=elogind.git diff --git a/namedev.c b/namedev.c index cd38f25cb..2f9d8f5f6 100644 --- a/namedev.c +++ b/namedev.c @@ -33,12 +33,12 @@ #include #include +#include "libsysfs/sysfs/libsysfs.h" #include "list.h" #include "udev.h" #include "udev_version.h" #include "logging.h" #include "namedev.h" -#include "libsysfs/libsysfs.h" #include "klibc_fixups.h" static struct sysfs_attribute *find_sysfs_attribute(struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device, char *attr); @@ -219,6 +219,7 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys char *pos3; char *attr; int num; + int i; char c; struct sysfs_attribute *tmpattr; @@ -270,11 +271,15 @@ static void apply_format(struct udevice *udev, unsigned char *string, struct sys case 'c': if (strlen(udev->program_result) == 0) break; - if (num > 0) { + /* get part part of the result string */ + i = num; /* num syntax is deprecated and will be removed */ + if (attr != NULL) + i = atoi(attr); + if (i > 0) { strncpy(temp1, udev->program_result, sizeof(temp1)); pos2 = temp1; - while (num) { - num--; + while (i) { + i--; pos3 = strsep(&pos2, " "); if (pos3 == NULL) { dbg("requested part of result string not found"); @@ -618,7 +623,8 @@ static struct sysfs_device *get_sysfs_device(struct sysfs_class_device *class_de tspec.tv_nsec = 10000000; /* sleep 10 millisec */ loop = 10; while (loop--) { - nanosleep(&tspec, NULL); + if (udev_sleep) + nanosleep(&tspec, NULL); if (class_dev_parent) sysfs_device = sysfs_get_classdev_device(class_dev_parent); else @@ -645,7 +651,8 @@ device_found: loop = 10; tspec.tv_nsec = 10000000; while (loop--) { - nanosleep(&tspec, NULL); + if (udev_sleep) + nanosleep(&tspec, NULL); sysfs_get_device_bus(sysfs_device); if (sysfs_device->bus[0] != '\0') @@ -820,7 +827,7 @@ found: /* substitute placeholder */ apply_format(udev, udev->name, class_dev, sysfs_device); apply_format(udev, udev->symlink, class_dev, sysfs_device); - + udev->partitions = dev->partitions; done: perm = find_perm(udev->name); if (perm) {