X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=udev_lib.c;h=86a526f7e816ecca46aedf4dc622a355d92b7b74;hb=8a0dc204e902a47a5b251c6d4a29eddb8f4a634a;hp=d745c9bd8680b0cb1ce1b2417f6cb9cbc8c67f2f;hpb=fc2aa296137017ad748ef2a7fa08bf9de1336272;p=elogind.git diff --git a/udev_lib.c b/udev_lib.c index d745c9bd8..86a526f7e 100644 --- a/udev_lib.c +++ b/udev_lib.c @@ -40,6 +40,7 @@ void udev_set_values(struct udevice *udev, const char* devpath, const char *subsystem, const char* action) { memset(udev, 0x00, sizeof(struct udevice)); + if (devpath) strfieldcpy(udev->devpath, devpath); if (subsystem) @@ -49,28 +50,24 @@ void udev_set_values(struct udevice *udev, const char* devpath, if (strcmp(udev->subsystem, "block") == 0) udev->type = 'b'; - - if (strcmp(udev->subsystem, "net") == 0) + else if (strcmp(udev->subsystem, "net") == 0) udev->type = 'n'; - - if (strncmp(udev->devpath, "/block/", 7) == 0) + else if (strncmp(udev->devpath, "/block/", 7) == 0) udev->type = 'b'; - - if (strncmp(udev->devpath, "/class/net/", 11) == 0) + else if (strncmp(udev->devpath, "/class/net/", 11) == 0) udev->type = 'n'; - - if (strncmp(udev->devpath, "/class/", 7) == 0) + else if (strncmp(udev->devpath, "/class/", 7) == 0) udev->type = 'c'; } int kernel_release_satisfactory(int version, int patchlevel, int sublevel) { - static struct utsname uts; static int kversion = 0; static int kpatchlevel; static int ksublevel; if (kversion == 0) { + struct utsname uts; if (uname(&uts) != 0) return -1;