X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fudev%2Fudev-builtin-net_id.c;h=5719021e93bca5f0e6fe40e929b22880e3a743fc;hp=7ffdaad73fa2389225ce997ca1db276b0758444e;hb=b92bea5d2a9481de69bb627a7b442a9f58fca43d;hpb=25da63b9dac8f166ebf390ca92d1de18fbfc9d11 diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 7ffdaad73..5719021e9 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -91,6 +91,7 @@ #include #include "udev.h" +#include "fileio.h" enum netname_type{ NET_UNDEF, @@ -223,7 +224,7 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { snprintf(str, sizeof(str), "%s/%s/address", slots, dent->d_name); if (read_one_line_file(str, &address) >= 0) { /* match slot address with device by stripping the function */ - if (strncmp(address, udev_device_get_sysname(names->pcidev), strlen(address)) == 0) + if (strneq(address, udev_device_get_sysname(names->pcidev), strlen(address))) hotplug_slot = i; free(address); } @@ -255,7 +256,7 @@ static int names_pci(struct udev_device *dev, struct netnames *names) { if (!parent) return -ENOENT; /* check if our direct parent is a PCI device with no other bus in-between */ - if (streq("pci", udev_device_get_subsystem(parent))) { + if (streq_ptr("pci", udev_device_get_subsystem(parent))) { names->type = NET_PCI; names->pcidev = parent; } else { @@ -395,7 +396,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool unsigned int i; const char *devtype; const char *prefix = "en"; - struct netnames names; + struct netnames names = {}; int err; /* handle only ARPHRD_ETHER devices */ @@ -413,7 +414,7 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool p = udev_device_get_sysattr_value(dev, "iflink"); if (!p) return EXIT_FAILURE; - if (strcmp(s, p) != 0) + if (!streq(s, p)) return 0; devtype = udev_device_get_devtype(dev); @@ -424,7 +425,6 @@ static int builtin_net_id(struct udev_device *dev, int argc, char *argv[], bool prefix = "ww"; } - zero(names); err = names_mac(dev, &names); if (err >= 0 && names.mac_valid) { char str[IFNAMSIZ];