X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fudev%2Fudev-builtin-blkid.c;h=39f286a745977a404efaf4e827ad4937c43b63b3;hb=dbf61afb29e016fe1b4ac48312a782df1d60a3e6;hp=174e20e2fa161c6e2b778e2682603e089f4e5851;hpb=baa30fbc2c04b23209d0b8fb3c86cd15ef9ea81a;p=elogind.git diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 174e20e2f..39f286a74 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -37,45 +37,45 @@ static void print_property(struct udev_device *dev, bool test, const char *name, s[0] = '\0'; - if (!strcmp(name, "TYPE")) { + if (streq(name, "TYPE")) { udev_builtin_add_property(dev, test, "ID_FS_TYPE", value); - } else if (!strcmp(name, "USAGE")) { + } else if (streq(name, "USAGE")) { udev_builtin_add_property(dev, test, "ID_FS_USAGE", value); - } else if (!strcmp(name, "VERSION")) { + } else if (streq(name, "VERSION")) { udev_builtin_add_property(dev, test, "ID_FS_VERSION", value); - } else if (!strcmp(name, "UUID")) { + } else if (streq(name, "UUID")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_ENC", s); - } else if (!strcmp(name, "UUID_SUB")) { + } else if (streq(name, "UUID_SUB")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_UUID_SUB_ENC", s); - } else if (!strcmp(name, "LABEL")) { + } else if (streq(name, "LABEL")) { blkid_safe_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_LABEL", s); blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_FS_LABEL_ENC", s); - } else if (!strcmp(name, "PTTYPE")) { + } else if (streq(name, "PTTYPE")) { udev_builtin_add_property(dev, test, "ID_PART_TABLE_TYPE", value); - } else if (!strcmp(name, "PART_ENTRY_NAME")) { + } else if (streq(name, "PART_ENTRY_NAME")) { blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_PART_ENTRY_NAME", s); - } else if (!strcmp(name, "PART_ENTRY_TYPE")) { + } else if (streq(name, "PART_ENTRY_TYPE")) { blkid_encode_string(value, s, sizeof(s)); udev_builtin_add_property(dev, test, "ID_PART_ENTRY_TYPE", s); - } else if (!strncmp(name, "PART_ENTRY_", 11)) { + } else if (startswith(name, "PART_ENTRY_")) { util_strscpyl(s, sizeof(s), "ID_", name, NULL); udev_builtin_add_property(dev, test, s, value); } @@ -115,7 +115,6 @@ static int probe_superblocks(blkid_probe pr) static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool test) { - struct udev *udev = udev_device_get_udev(dev); int64_t offset = 0; bool noraid = false; int fd = -1; @@ -151,10 +150,8 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t } pr = blkid_new_probe(); - if (!pr) { - err = -ENOMEM; + if (!pr) return EXIT_FAILURE; - } blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |