X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=namedev.c;h=89513934ff4e483a49d60f621c973ddfd77d49f0;hb=0bad3406c1e8eba6d5af2cbfd44d8a61231fa2bb;hp=942788b2a2a83519ec785f209eaf589d84b597a4;hpb=50e5de03d16be3e35e65cdf65f552807ad24e996;p=elogind.git diff --git a/namedev.c b/namedev.c index 942788b2a..89513934f 100644 --- a/namedev.c +++ b/namedev.c @@ -32,13 +32,13 @@ #include #include #include +#include #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')