diff options
author | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:07:06 -0400 |
---|---|---|
committer | Anthony G. Basile <blueness@gentoo.org> | 2013-07-07 11:16:55 -0400 |
commit | faa1ff8ef8d98fe148ac0efab15fcdf0cabdcaae (patch) | |
tree | 4f0816897494168e1d0bab25367fb5b6782aaaa4 /src/udev | |
parent | 44e6f1bc1a3f11daf569d310de1707f3b423786a (diff) |
Import strxcpyx from upstream
This commit imports strxcpyx from upstream. This is upstream commit
d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d
Note: there were also some very minor code cleanups to
accelerometer.c: line 187
collect.c: lines 35, 140
libudev-device.c: line 780
libudev-hwdb.c: line 300
These are part of upstream commits:
507f22bd0172bff5e5d98145b1419bd472a2c57f
3cf7b686e6b29f78de0af5929602cae4482f6d49
67410e9f73a6cdd8453c78b966451b5151def14a
Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/udev-builtin-blkid.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-btrfs.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-firmware.c | 8 | ||||
-rw-r--r-- | src/udev/udev-builtin-kmod.c | 2 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 28 | ||||
-rw-r--r-- | src/udev/udev-builtin-path_id.c | 28 | ||||
-rw-r--r-- | src/udev/udev-builtin-usb_id.c | 14 | ||||
-rw-r--r-- | src/udev/udev-builtin.c | 6 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 4 | ||||
-rw-r--r-- | src/udev/udev-event.c | 73 | ||||
-rw-r--r-- | src/udev/udev-node.c | 26 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 30 | ||||
-rw-r--r-- | src/udev/udevadm-info.c | 16 | ||||
-rw-r--r-- | src/udev/udevadm-monitor.c | 2 | ||||
-rw-r--r-- | src/udev/udevadm-test-builtin.c | 4 | ||||
-rw-r--r-- | src/udev/udevadm-test.c | 10 | ||||
-rw-r--r-- | src/udev/udevadm-trigger.c | 12 | ||||
-rw-r--r-- | src/udev/udevadm.c | 2 | ||||
-rw-r--r-- | src/udev/udevd.c | 16 |
19 files changed, 142 insertions, 143 deletions
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index e3a89973cb..bae429344f 100644 --- a/src/udev/udev-builtin-blkid.c +++ b/src/udev/udev-builtin-blkid.c @@ -76,7 +76,7 @@ static void print_property(struct udev_device *dev, bool test, const char *name, udev_builtin_add_property(dev, test, "ID_PART_ENTRY_TYPE", s); } else if (startswith(name, "PART_ENTRY_")) { - util_strscpyl(s, sizeof(s), "ID_", name, NULL); + strscpyl(s, sizeof(s), "ID_", name, NULL); udev_builtin_add_property(dev, test, s, value); } else if (streq(name, "SYSTEM_ID")) { diff --git a/src/udev/udev-builtin-btrfs.c b/src/udev/udev-builtin-btrfs.c index dfb05525ad..f7bea69b26 100644 --- a/src/udev/udev-builtin-btrfs.c +++ b/src/udev/udev-builtin-btrfs.c @@ -48,7 +48,7 @@ static int builtin_btrfs(struct udev_device *dev, int argc, char *argv[], bool t if (fd < 0) return EXIT_FAILURE; - util_strscpy(args.name, sizeof(args.name), argv[2]); + strscpy(args.name, sizeof(args.name), argv[2]); err = ioctl(fd, BTRFS_IOC_DEVICES_READY, &args); close(fd); if (err < 0) diff --git a/src/udev/udev-builtin-firmware.c b/src/udev/udev-builtin-firmware.c index a23b8c1a46..b80940b6ef 100644 --- a/src/udev/udev-builtin-firmware.c +++ b/src/udev/udev-builtin-firmware.c @@ -98,18 +98,18 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo /* lookup firmware file */ uname(&kernel); for (i = 0; i < ELEMENTSOF(searchpath); i++) { - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); + strscpyl(fwpath, sizeof(fwpath), searchpath[i], kernel.release, "/", firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; - util_strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); + strscpyl(fwpath, sizeof(fwpath), searchpath[i], firmware, NULL); fwfile = fopen(fwpath, "re"); if (fwfile != NULL) break; } - util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); + strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); if (fwfile == NULL) { log_debug("did not find firmware file '%s'\n", firmware); @@ -134,7 +134,7 @@ static int builtin_firmware(struct udev_device *dev, int argc, char *argv[], boo if (!set_loading(udev, loadpath, "1")) goto exit; - util_strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); + strscpyl(datapath, sizeof(datapath), udev_device_get_syspath(dev), "/data", NULL); if (!copy_firmware(udev, fwpath, datapath, statbuf.st_size)) { log_error("error sending firmware '%s' to device\n", firmware); set_loading(udev, loadpath, "-1"); diff --git a/src/udev/udev-builtin-kmod.c b/src/udev/udev-builtin-kmod.c index d2148a8ab2..e2b97dbc4c 100644 --- a/src/udev/udev-builtin-kmod.c +++ b/src/udev/udev-builtin-kmod.c @@ -89,7 +89,7 @@ static int builtin_kmod(struct udev_device *dev, int argc, char *argv[], bool te return 0; #endif - if (argc < 3 || strcmp(argv[1], "load")) { + if (argc < 3 || !streq(argv[1], "load")) { log_error("expect: %s load <module>\n", argv[0]); return EXIT_FAILURE; } diff --git a/src/udev/udev-builtin-net_id.c b/src/udev/udev-builtin-net_id.c index 37ae710ea9..9c1c5feb0d 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -193,12 +193,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { s = names->pci_path; l = sizeof(names->pci_path); if (domain > 0) - l = util_strpcpyf(&s, l, "P%d", domain); - l = util_strpcpyf(&s, l, "p%ds%d", bus, slot); + l = strpcpyf(&s, l, "P%d", domain); + l = strpcpyf(&s, l, "p%ds%d", bus, slot); if (func > 0 || is_pci_multifunction(names->pcidev)) - l = util_strpcpyf(&s, l, "f%d", func); + l = strpcpyf(&s, l, "f%d", func); if (dev_id > 0) - l = util_strpcpyf(&s, l, "d%d", dev_id); + l = strpcpyf(&s, l, "d%d", dev_id); if (l == 0) names->pci_path[0] = '\0'; @@ -230,7 +230,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); } @@ -244,12 +244,12 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { s = names->pci_slot; l = sizeof(names->pci_slot); if (domain > 0) - l = util_strpcpyf(&s, l, "P%d", domain); - l = util_strpcpyf(&s, l, "s%d", hotplug_slot); + l = strpcpyf(&s, l, "P%d", domain); + l = strpcpyf(&s, l, "s%d", hotplug_slot); if (func > 0 || is_pci_multifunction(names->pcidev)) - l = util_strpcpyf(&s, l, "f%d", func); + l = strpcpyf(&s, l, "f%d", func); if (dev_id > 0) - l = util_strpcpyf(&s, l, "d%d", dev_id); + l = strpcpyf(&s, l, "d%d", dev_id); if (l == 0) names->pci_path[0] = '\0'; } @@ -292,7 +292,7 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { return -ENOENT; /* get USB port number chain, configuration, interface */ - util_strscpy(name, sizeof(name), udev_device_get_sysname(usbdev)); + strscpy(name, sizeof(name), udev_device_get_sysname(usbdev)); s = strchr(name, '-'); if (!s) return -EINVAL; @@ -315,15 +315,15 @@ static int names_usb(struct udev_device *dev, struct netnames *names) { while ((s = strchr(s, '.'))) s[0] = 'u'; s = names->usb_ports; - l = util_strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "u", ports, NULL); /* append USB config number, suppress the common config == 1 */ if (!streq(config, "1")) - l = util_strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "c", config, NULL); /* append USB interface number, suppress the interface == 0 */ if (!streq(interf, "0")) - l = util_strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL); + l = strpcpyl(&s, sizeof(names->usb_ports), "i", interf, NULL); if (l == 0) return -ENAMETOOLONG; @@ -423,7 +423,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); diff --git a/src/udev/udev-builtin-path_id.c b/src/udev/udev-builtin-path_id.c index d6b3736aee..da0273197b 100644 --- a/src/udev/udev-builtin-path_id.c +++ b/src/udev/udev-builtin-path_id.c @@ -83,7 +83,7 @@ static struct udev_device *skip_subsystem(struct udev_device *dev, const char *s const char *subsystem; subsystem = udev_device_get_subsystem(parent); - if (subsystem == NULL || strcmp(subsystem, subsys) != 0) + if (subsystem == NULL || !streq(subsystem, subsys)) break; dev = parent; parent = udev_device_get_parent(parent); @@ -345,7 +345,7 @@ static struct udev_device *handle_scsi(struct udev_device *parent, char **path) const char *id; devtype = udev_device_get_devtype(parent); - if (devtype == NULL || strcmp(devtype, "scsi_device") != 0) + if (devtype == NULL || !streq(devtype, "scsi_device")) return parent; /* firewire */ @@ -438,7 +438,7 @@ static struct udev_device *handle_usb(struct udev_device *parent, char **path) devtype = udev_device_get_devtype(parent); if (devtype == NULL) return parent; - if (strcmp(devtype, "usb_interface") != 0 && strcmp(devtype, "usb_device") != 0) + if (!streq(devtype, "usb_interface") && !streq(devtype, "usb_device")) return parent; str = udev_device_get_sysname(parent); @@ -498,37 +498,37 @@ static int builtin_path_id(struct udev_device *dev, int argc, char *argv[], bool subsys = udev_device_get_subsystem(parent); if (subsys == NULL) { ; - } else if (strcmp(subsys, "scsi_tape") == 0) { + } else if (streq(subsys, "scsi_tape")) { handle_scsi_tape(parent, &path); - } else if (strcmp(subsys, "scsi") == 0) { + } else if (streq(subsys, "scsi")) { parent = handle_scsi(parent, &path); some_transport = true; - } else if (strcmp(subsys, "cciss") == 0) { + } else if (streq(subsys, "cciss")) { parent = handle_cciss(parent, &path); some_transport = true; - } else if (strcmp(subsys, "usb") == 0) { + } else if (streq(subsys, "usb")) { parent = handle_usb(parent, &path); some_transport = true; - } else if (strcmp(subsys, "serio") == 0) { + } else if (streq(subsys, "serio")) { path_prepend(&path, "serio-%s", udev_device_get_sysnum(parent)); parent = skip_subsystem(parent, "serio"); - } else if (strcmp(subsys, "pci") == 0) { + } else if (streq(subsys, "pci")) { path_prepend(&path, "pci-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "pci"); - } else if (strcmp(subsys, "platform") == 0) { + } else if (streq(subsys, "platform")) { path_prepend(&path, "platform-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "platform"); some_transport = true; - } else if (strcmp(subsys, "acpi") == 0) { + } else if (streq(subsys, "acpi")) { path_prepend(&path, "acpi-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "acpi"); - } else if (strcmp(subsys, "xen") == 0) { + } else if (streq(subsys, "xen")) { path_prepend(&path, "xen-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "xen"); - } else if (strcmp(subsys, "virtio") == 0) { + } else if (streq(subsys, "virtio")) { path_prepend(&path, "virtio-pci-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "virtio"); - } else if (strcmp(subsys, "scm") == 0) { + } else if (streq(subsys, "scm")) { path_prepend(&path, "scm-%s", udev_device_get_sysname(parent)); parent = skip_subsystem(parent, "scm"); } diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index b021d03a65..e3bbd05e4b 100644 --- a/src/udev/udev-builtin-usb_id.c +++ b/src/udev/udev-builtin-usb_id.c @@ -111,7 +111,7 @@ static int set_usb_mass_storage_ifsubtype(char *to, const char *from, size_t len break; } } - util_strscpy(to, len, type); + strscpy(to, len, type); return type_num; } @@ -143,7 +143,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) break; } } - util_strscpy(to, len, type); + strscpy(to, len, type); } #define USB_DT_DEVICE 0x01 @@ -152,7 +152,7 @@ static void set_scsi_type(char *to, const char *from, size_t len) static int dev_if_packed_info(struct udev_device *dev, char *ifs_str, size_t len) { _cleanup_free_ char *filename = NULL; - int _cleanup_close_ fd = -1; + _cleanup_close_ int fd = -1; ssize_t size; unsigned char buf[18 + 65535]; int pos = 0; @@ -267,7 +267,7 @@ static int builtin_usb_id(struct udev_device *dev, int argc, char *argv[], bool instance_str[0] = '\0'; /* shortcut, if we are called directly for a "usb_device" type */ - if (udev_device_get_devtype(dev) != NULL && strcmp(udev_device_get_devtype(dev), "usb_device") == 0) { + if (udev_device_get_devtype(dev) != NULL && streq(udev_device_get_devtype(dev), "usb_device")) { dev_if_packed_info(dev, packed_if_str, sizeof(packed_if_str)); dev_usb = dev; goto fallback; @@ -443,12 +443,12 @@ fallback: } s = serial; - l = util_strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); + l = strpcpyl(&s, sizeof(serial), vendor_str, "_", model_str, NULL); if (serial_str[0] != '\0') - l = util_strpcpyl(&s, l, "_", serial_str, NULL); + l = strpcpyl(&s, l, "_", serial_str, NULL); if (instance_str[0] != '\0') - util_strpcpyl(&s, l, "-", instance_str, NULL); + strpcpyl(&s, l, "-", instance_str, NULL); udev_builtin_add_property(dev, test, "ID_VENDOR", vendor_str); udev_builtin_add_property(dev, test, "ID_VENDOR_ENC", vendor_str_enc); diff --git a/src/udev/udev-builtin.c b/src/udev/udev-builtin.c index 226295f686..22deaac1a8 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -109,12 +109,12 @@ enum udev_builtin_cmd udev_builtin_lookup(const char *command) enum udev_builtin_cmd i; char *pos; - util_strscpy(name, sizeof(name), command); + strscpy(name, sizeof(name), command); pos = strchr(name, ' '); if (pos) pos[0] = '\0'; for (i = 0; i < ELEMENTSOF(builtins); i++) - if (strcmp(builtins[i]->name, name) == 0) + if (streq(builtins[i]->name, name)) return i; return UDEV_BUILTIN_MAX; } @@ -127,7 +127,7 @@ int udev_builtin_run(struct udev_device *dev, enum udev_builtin_cmd cmd, const c /* we need '0' here to reset the internal state */ optind = 0; - util_strscpy(arg, sizeof(arg), command); + strscpy(arg, sizeof(arg), command); udev_build_argv(udev_device_get_udev(dev), arg, &argc, argv); return builtins[cmd]->cmd(dev, argc, argv, test); } diff --git a/src/udev/udev-ctrl.c b/src/udev/udev-ctrl.c index fe318586fc..138b6f44b7 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -96,7 +96,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) setsockopt(uctrl->sock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on)); uctrl->saddr.sun_family = AF_LOCAL; - util_strscpy(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), "/run/udev/control"); + strscpy(uctrl->saddr.sun_path, sizeof(uctrl->saddr.sun_path), "/run/udev/control"); uctrl->addrlen = offsetof(struct sockaddr_un, sun_path) + strlen(uctrl->saddr.sun_path); return uctrl; } @@ -274,7 +274,7 @@ static int ctrl_send(struct udev_ctrl *uctrl, enum udev_ctrl_msg_type type, int ctrl_msg_wire.type = type; if (buf != NULL) - util_strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); + strscpy(ctrl_msg_wire.buf, sizeof(ctrl_msg_wire.buf), buf); else ctrl_msg_wire.intval = intval; diff --git a/src/udev/udev-event.c b/src/udev/udev-event.c index c6c5940ff6..7cf82fd8a6 100644 --- a/src/udev/udev-event.c +++ b/src/udev/udev-event.c @@ -191,20 +191,20 @@ subst: switch (type) { case SUBST_DEVPATH: - l = util_strpcpy(&s, l, udev_device_get_devpath(dev)); + l = strpcpy(&s, l, udev_device_get_devpath(dev)); break; case SUBST_KERNEL: - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + l = strpcpy(&s, l, udev_device_get_sysname(dev)); break; case SUBST_KERNEL_NUMBER: if (udev_device_get_sysnum(dev) == NULL) break; - l = util_strpcpy(&s, l, udev_device_get_sysnum(dev)); + l = strpcpy(&s, l, udev_device_get_sysnum(dev)); break; case SUBST_ID: if (event->dev_parent == NULL) break; - l = util_strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); + l = strpcpy(&s, l, udev_device_get_sysname(event->dev_parent)); break; case SUBST_DRIVER: { const char *driver; @@ -215,21 +215,21 @@ subst: driver = udev_device_get_driver(event->dev_parent); if (driver == NULL) break; - l = util_strpcpy(&s, l, driver); + l = strpcpy(&s, l, driver); break; } case SUBST_MAJOR: { char num[UTIL_PATH_SIZE]; sprintf(num, "%d", major(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); + l = strpcpy(&s, l, num); break; } case SUBST_MINOR: { char num[UTIL_PATH_SIZE]; sprintf(num, "%d", minor(udev_device_get_devnum(dev))); - l = util_strpcpy(&s, l, num); + l = strpcpy(&s, l, num); break; } case SUBST_RESULT: { @@ -247,7 +247,7 @@ subst: char tmp[UTIL_PATH_SIZE]; char *cpos; - util_strscpy(result, sizeof(result), event->program_result); + strscpy(result, sizeof(result), event->program_result); cpos = result; while (--i) { while (cpos[0] != '\0' && !isspace(cpos[0])) @@ -259,16 +259,16 @@ subst: log_error("requested part of result string not found\n"); break; } - util_strscpy(tmp, sizeof(tmp), cpos); + strscpy(tmp, sizeof(tmp), cpos); /* %{2+}c copies the whole string from the second part on */ if (rest[0] != '+') { cpos = strchr(tmp, ' '); if (cpos) cpos[0] = '\0'; } - l = util_strpcpy(&s, l, tmp); + l = strpcpy(&s, l, tmp); } else { - l = util_strpcpy(&s, l, event->program_result); + l = strpcpy(&s, l, event->program_result); } break; } @@ -300,14 +300,14 @@ subst: /* strip trailing whitespace, and replace unwanted characters */ if (value != vbuf) - util_strscpy(vbuf, sizeof(vbuf), value); + strscpy(vbuf, sizeof(vbuf), value); len = strlen(vbuf); while (len > 0 && isspace(vbuf[--len])) vbuf[len] = '\0'; count = util_replace_chars(vbuf, UDEV_ALLOWED_CHARS_INPUT); if (count > 0) log_debug("%i character(s) replaced\n" , count); - l = util_strpcpy(&s, l, vbuf); + l = strpcpy(&s, l, vbuf); break; } case SUBST_PARENT: { @@ -319,20 +319,20 @@ subst: break; devnode = udev_device_get_devnode(dev_parent); if (devnode != NULL) - l = util_strpcpy(&s, l, devnode + strlen("/dev/")); + l = strpcpy(&s, l, devnode + strlen("/dev/")); break; } case SUBST_DEVNODE: if (udev_device_get_devnode(dev) != NULL) - l = util_strpcpy(&s, l, udev_device_get_devnode(dev)); + l = strpcpy(&s, l, udev_device_get_devnode(dev)); break; case SUBST_NAME: if (event->name != NULL) - l = util_strpcpy(&s, l, event->name); + l = strpcpy(&s, l, event->name); else if (udev_device_get_devnode(dev) != NULL) - l = util_strpcpy(&s, l, udev_device_get_devnode(dev) + strlen("/dev/")); + l = strpcpy(&s, l, udev_device_get_devnode(dev) + strlen("/dev/")); else - l = util_strpcpy(&s, l, udev_device_get_sysname(dev)); + l = strpcpy(&s, l, udev_device_get_sysname(dev)); break; case SUBST_LINKS: { struct udev_list_entry *list_entry; @@ -340,16 +340,16 @@ subst: list_entry = udev_device_get_devlinks_list_entry(dev); if (list_entry == NULL) break; - l = util_strpcpy(&s, l, udev_list_entry_get_name(list_entry) + strlen("/dev/")); + l = strpcpy(&s, l, udev_list_entry_get_name(list_entry) + strlen("/dev/")); udev_list_entry_foreach(list_entry, udev_list_entry_get_next(list_entry)) - l = util_strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry) + strlen("/dev/"), NULL); + l = strpcpyl(&s, l, " ", udev_list_entry_get_name(list_entry) + strlen("/dev/"), NULL); break; } case SUBST_ROOT: - l = util_strpcpy(&s, l, "/dev"); + l = strpcpy(&s, l, "/dev"); break; case SUBST_SYS: - l = util_strpcpy(&s, l, "/sys"); + l = strpcpy(&s, l, "/sys"); break; case SUBST_ENV: if (attr == NULL) { @@ -360,7 +360,7 @@ subst: value = udev_device_get_property_value(event->dev, attr); if (value == NULL) break; - l = util_strpcpy(&s, l, value); + l = strpcpy(&s, l, value); break; } default: @@ -667,7 +667,7 @@ int udev_event_spawn(struct udev_event *event, char program[UTIL_PATH_SIZE]; int err = 0; - util_strscpy(arg, sizeof(arg), cmd); + strscpy(arg, sizeof(arg), cmd); udev_build_argv(event->udev, arg, NULL, argv); /* pipes from child to parent */ @@ -687,14 +687,13 @@ int udev_event_spawn(struct udev_event *event, } /* allow programs in /usr/lib/udev/ to be called without the path */ - /* NOTE - paths need reworking, see note in udev-rules.c */ if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), UDEV_LIBEXEC_DIR "/", argv[0], NULL); + strscpyl(program, sizeof(program), UDEV_LIBEXEC_DIR "/", argv[0], NULL); #ifdef HAVE_SPLIT_USR if(access(program, X_OK)) - util_strscpyl(program, sizeof(program), "/usr/lib/udev/", argv[0], NULL); + strscpyl(program, sizeof(program), "/usr/lib/udev/", argv[0], NULL); if(access(program, X_OK)) - util_strscpyl(program, sizeof(program), "/lib/udev/", argv[0], NULL); + strscpyl(program, sizeof(program), "/lib/udev/", argv[0], NULL); #endif argv[0] = program; } @@ -792,8 +791,8 @@ static int rename_netif(struct udev_event *event) } memset(&ifr, 0x00, sizeof(struct ifreq)); - util_strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + strscpy(ifr.ifr_name, IFNAMSIZ, udev_device_get_sysname(dev)); + strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); err = ioctl(sk, SIOCSIFNAME, &ifr); #ifdef ENABLE_RULE_GENERATOR @@ -821,8 +820,8 @@ static int rename_netif(struct udev_event *event) rename_netif_kernel_log(ifr); /* wait a maximum of 90 seconds for our target to become available */ - util_strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); - util_strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); + strscpy(ifr.ifr_name, IFNAMSIZ, ifr.ifr_newname); + strscpy(ifr.ifr_newname, IFNAMSIZ, event->name); loop = 90 * 20; while (loop--) { const struct timespec duration = { 0, 1000 * 1000 * 1000 / 20 }; @@ -863,7 +862,7 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, if (udev_device_get_subsystem(dev) == NULL) return -1; - if (strcmp(udev_device_get_action(dev), "remove") == 0) { + if (streq(udev_device_get_action(dev), "remove")) { udev_device_read_db(dev, NULL); udev_device_delete_db(dev); udev_device_tag_index(dev, NULL, false); @@ -891,8 +890,8 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, udev_rules_apply_to_event(rules, event, sigmask); /* rename a new network interface, if needed */ - if (udev_device_get_ifindex(dev) > 0 && strcmp(udev_device_get_action(dev), "add") == 0 && - event->name != NULL && strcmp(event->name, udev_device_get_sysname(dev)) != 0) { + if (udev_device_get_ifindex(dev) > 0 && streq(udev_device_get_action(dev), "add") && + event->name != NULL && !streq(event->name, udev_device_get_sysname(dev))) { char syspath[UTIL_PATH_SIZE]; char *pos; @@ -904,11 +903,11 @@ int udev_event_execute_rules(struct udev_event *event, struct udev_rules *rules, udev_device_add_property(dev, "INTERFACE_OLD", udev_device_get_sysname(dev)); /* now change the devpath, because the kernel device name has changed */ - util_strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); + strscpy(syspath, sizeof(syspath), udev_device_get_syspath(dev)); pos = strrchr(syspath, '/'); if (pos != NULL) { pos++; - util_strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); + strscpy(pos, sizeof(syspath) - (pos - syspath), event->name); udev_device_set_syspath(event->dev, syspath); udev_device_add_property(dev, "INTERFACE", udev_device_get_sysname(dev)); log_debug("changed devpath to '%s'\n", udev_device_get_devpath(dev)); diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c index d10c63aaa0..4fca46495e 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -53,10 +53,10 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s l = sizeof(target); while (slink[i] != '\0') { if (slink[i] == '/') - l = util_strpcpy(&s, l, "../"); + l = strpcpy(&s, l, "../"); i++; } - l = util_strscpy(s, l, &node[tail]); + l = strscpy(s, l, &node[tail]); if (l == 0) { err = -EINVAL; goto exit; @@ -74,7 +74,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s len = readlink(slink, buf, sizeof(buf)); if (len > 0 && len < (int)sizeof(buf)) { buf[len] = '\0'; - if (strcmp(target, buf) == 0) { + if (streq(target, buf)) { log_debug("preserve already existing symlink '%s' to '%s'\n", slink, target); label_fix(slink, true, false); utimensat(AT_FDCWD, slink, NULL, AT_SYMLINK_NOFOLLOW); @@ -99,7 +99,7 @@ static int node_symlink(struct udev_device *dev, const char *node, const char *s } log_debug("atomically replace '%s'\n", slink); - util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL); + strscpyl(slink_tmp, sizeof(slink_tmp), slink, ".tmp-", udev_device_get_id_filename(dev), NULL); unlink(slink_tmp); do { err = mkdir_parents_label(slink_tmp, 0755); @@ -134,7 +134,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons if (add) { priority = udev_device_get_devlink_priority(dev); - util_strscpy(buf, bufsize, udev_device_get_devnode(dev)); + strscpy(buf, bufsize, udev_device_get_devnode(dev)); target = buf; } @@ -154,7 +154,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons log_debug("found '%s' claiming '%s'\n", dent->d_name, stackdir); /* did we find ourself? */ - if (strcmp(dent->d_name, udev_device_get_id_filename(dev)) == 0) + if (streq(dent->d_name, udev_device_get_id_filename(dev))) continue; dev_db = udev_device_new_from_device_id(udev, dent->d_name); @@ -167,7 +167,7 @@ static const char *link_find_prioritized(struct udev_device *dev, bool add, cons log_debug("'%s' claims priority %i for '%s'\n", udev_device_get_syspath(dev_db), udev_device_get_devlink_priority(dev_db), stackdir); priority = udev_device_get_devlink_priority(dev_db); - util_strscpy(buf, bufsize, devnode); + strscpy(buf, bufsize, devnode); target = buf; } } @@ -189,8 +189,8 @@ static void link_update(struct udev_device *dev, const char *slink, bool add) char buf[UTIL_PATH_SIZE]; util_path_encode(slink + strlen("/dev"), name_enc, sizeof(name_enc)); - util_strscpyl(dirname, sizeof(dirname), "/run/udev/links/", name_enc, NULL); - util_strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); + strscpyl(dirname, sizeof(dirname), "/run/udev/links/", name_enc, NULL); + strscpyl(filename, sizeof(filename), dirname, "/", udev_device_get_id_filename(dev), NULL); if (!add && unlink(filename) == 0) rmdir(dirname); @@ -238,7 +238,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev udev_list_entry_foreach(list_entry_current, udev_device_get_devlinks_list_entry(dev)) { const char *name_current = udev_list_entry_get_name(list_entry_current); - if (strcmp(name, name_current) == 0) { + if (streq(name, name_current)) { found = 1; break; } @@ -259,7 +259,7 @@ static int node_permissions_apply(struct udev_device *dev, bool apply, mode_t mo struct stat stats; int err = 0; - if (strcmp(udev_device_get_subsystem(dev), "block") == 0) + if (streq(udev_device_get_subsystem(dev), "block")) mode |= S_IFBLK; else mode |= S_IFCHR; @@ -308,7 +308,7 @@ void udev_node_add(struct udev_device *dev, bool apply, mode_t mode, uid_t uid, /* always add /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "/dev/%s/%u:%u", - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + streq(udev_device_get_subsystem(dev), "block") ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); node_symlink(dev, udev_device_get_devnode(dev), filename); @@ -328,7 +328,7 @@ void udev_node_remove(struct udev_device *dev) /* remove /dev/{block,char}/$major:$minor */ snprintf(filename, sizeof(filename), "/dev/%s/%u:%u", - strcmp(udev_device_get_subsystem(dev), "block") == 0 ? "block" : "char", + streq(udev_device_get_subsystem(dev), "block") ? "block" : "char", major(udev_device_get_devnum(dev)), minor(udev_device_get_devnum(dev))); unlink(filename); } diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 9844b8a80a..e947f317c9 100644 --- a/src/udev/udev-rules.c +++ b/src/udev/udev-rules.c @@ -600,7 +600,7 @@ static int import_property_from_string(struct udev_device *dev, char *line) log_debug("updating devpath from '%s' to '%s'\n", udev_device_get_devpath(dev), val); - util_strscpyl(syspath, sizeof(syspath), "/sys", val, NULL); + strscpyl(syspath, sizeof(syspath), "/sys", val, NULL); udev_device_set_syspath(dev, syspath); } else { struct udev_list_entry *entry; @@ -691,8 +691,8 @@ static int wait_for_file(struct udev_device *dev, const char *file, int timeout) /* a relative path is a device attribute */ devicepath[0] = '\0'; if (file[0] != '/') { - util_strscpyl(devicepath, sizeof(devicepath), udev_device_get_syspath(dev), NULL); - util_strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); + strscpyl(devicepath, sizeof(devicepath), udev_device_get_syspath(dev), NULL); + strscpyl(filepath, sizeof(filepath), devicepath, "/", file, NULL); file = filepath; } @@ -726,7 +726,7 @@ static int attr_subst_subdir(char *attr, size_t len) const char *tail; DIR *dir; - util_strscpy(dirname, sizeof(dirname), attr); + strscpy(dirname, sizeof(dirname), attr); pos = strstr(dirname, "/*/"); if (pos == NULL) return -1; @@ -741,7 +741,7 @@ static int attr_subst_subdir(char *attr, size_t len) if (dent->d_name[0] == '.') continue; - util_strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); + strscpyl(attr, len, dirname, "/", dent->d_name, tail, NULL); if (stat(attr, &stats) == 0) { found = true; break; @@ -1742,7 +1742,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * if (next != NULL) { size_t matchlen = (size_t)(next - s); - match = (matchlen == len && strncmp(s, val, matchlen) == 0); + match = (matchlen == len && strneq(s, val, matchlen)); if (match) break; } else { @@ -1757,7 +1757,7 @@ static int match_key(struct udev_rules *rules, struct token *token, const char * { char value[UTIL_PATH_SIZE]; - util_strscpy(value, sizeof(value), rules_str(rules, token->key.value_off)); + strscpy(value, sizeof(value), rules_str(rules, token->key.value_off)); key_value = value; while (key_value != NULL) { pos = strchr(key_value, '|'); @@ -1824,7 +1824,7 @@ static int match_attr(struct udev_rules *rules, struct udev_device *dev, struct klen = strlen(key_value); if (klen > 0 && !isspace(key_value[klen-1])) { if (value != vbuf) { - util_strscpy(vbuf, sizeof(vbuf), value); + strscpy(vbuf, sizeof(vbuf), value); value = vbuf; } while (len > 0 && isspace(vbuf[--len])) @@ -2020,8 +2020,8 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (filename[0] != '/') { char tmp[UTIL_PATH_SIZE]; - util_strscpy(tmp, sizeof(tmp), filename); - util_strscpyl(filename, sizeof(filename), + strscpy(tmp, sizeof(tmp), filename); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(event->dev), "/", tmp, NULL); } } @@ -2333,7 +2333,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event /* append value separated by space */ udev_event_apply_format(event, value, temp, sizeof(temp)); - util_strscpyl(value_new, sizeof(value_new), value_old, " ", temp, NULL); + strscpyl(value_new, sizeof(value_new), value_old, " ", temp, NULL); } else udev_event_apply_format(event, value, value_new, sizeof(value_new)); @@ -2424,7 +2424,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event next[0] = '\0'; log_debug("LINK '%s' %s:%u\n", pos, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), "/dev/", pos, NULL); + strscpyl(filename, sizeof(filename), "/dev/", pos, NULL); udev_device_add_devlink(event->dev, filename); while (isspace(next[1])) next++; @@ -2434,7 +2434,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event if (pos[0] != '\0') { log_debug("LINK '%s' %s:%u\n", pos, rules_str(rules, rule->rule.filename_off), rule->rule.filename_line); - util_strscpyl(filename, sizeof(filename), "/dev/", pos, NULL); + strscpyl(filename, sizeof(filename), "/dev/", pos, NULL); udev_device_add_devlink(event->dev, filename); } break; @@ -2446,7 +2446,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event FILE *f; if (util_resolve_subsys_kernel(event->udev, key_name, attr, sizeof(attr), 0) != 0) - util_strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); + strscpyl(attr, sizeof(attr), udev_device_get_syspath(event->dev), "/", key_name, NULL); attr_subst_subdir(attr, sizeof(attr)); udev_event_apply_format(event, rules_str(rules, cur->key.value_off), value, sizeof(value)); @@ -2544,7 +2544,7 @@ void udev_rules_apply_static_dev_perms(struct udev_rules *rules) /* we assure, that the permissions tokens are sorted before the static token */ if (mode == 0 && uid == 0 && gid == 0) goto next; - util_strscpyl(filename, sizeof(filename), "/dev/", rules_str(rules, cur->key.value_off), NULL); + strscpyl(filename, sizeof(filename), "/dev/", rules_str(rules, cur->key.value_off), NULL); if (stat(filename, &stats) != 0) goto next; if (!S_ISBLK(stats.st_mode) && !S_ISCHR(stats.st_mode)) diff --git a/src/udev/udevadm-info.c b/src/udev/udevadm-info.c index 75510c5178..0eaaea19ae 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -45,7 +45,7 @@ static bool skip_attribute(const char *name) unsigned int i; for (i = 0; i < ELEMENTSOF(skip); i++) - if (strcmp(name, skip[i]) == 0) + if (streq(name, skip[i])) return true; return false; } @@ -263,7 +263,7 @@ static struct udev_device *find_device(struct udev *udev, const char *id, const char name[UTIL_PATH_SIZE]; if (prefix && !startswith(id, prefix)) { - util_strscpyl(name, sizeof(name), prefix, id, NULL); + strscpyl(name, sizeof(name), prefix, id, NULL); id = name; } @@ -387,15 +387,15 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) break; case 'q': action = ACTION_QUERY; - if (strcmp(optarg, "property") == 0 || strcmp(optarg, "env") == 0) { + if (streq(optarg, "property") || streq(optarg, "env")) { query = QUERY_PROPERTY; - } else if (strcmp(optarg, "name") == 0) { + } else if (streq(optarg, "name")) { query = QUERY_NAME; - } else if (strcmp(optarg, "symlink") == 0) { + } else if (streq(optarg, "symlink")) { query = QUERY_SYMLINK; - } else if (strcmp(optarg, "path") == 0) { + } else if (streq(optarg, "path")) { query = QUERY_PATH; - } else if (strcmp(optarg, "all") == 0) { + } else if (streq(optarg, "all")) { query = QUERY_ALL; } else { fprintf(stderr, "unknown query type\n"); @@ -408,7 +408,7 @@ static int uinfo(struct udev *udev, int argc, char *argv[]) break; case 'd': action = ACTION_DEVICE_ID_FILE; - util_strscpy(name, sizeof(name), optarg); + strscpy(name, sizeof(name), optarg); break; case 'a': action = ACTION_ATTRIBUTE_WALK; diff --git a/src/udev/udevadm-monitor.c b/src/udev/udevadm-monitor.c index ffa70d8300..a390ee6c34 100644 --- a/src/udev/udevadm-monitor.c +++ b/src/udev/udevadm-monitor.c @@ -116,7 +116,7 @@ static int adm_monitor(struct udev *udev, int argc, char *argv[]) char subsys[UTIL_NAME_SIZE]; char *devtype; - util_strscpy(subsys, sizeof(subsys), optarg); + strscpy(subsys, sizeof(subsys), optarg); devtype = strchr(subsys, '/'); if (devtype != NULL) { devtype[0] = '\0'; diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index 9853d83b49..f4aa21ee72 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -96,9 +96,9 @@ static int adm_builtin(struct udev *udev, int argc, char *argv[]) /* add /sys if needed */ if (!startswith(syspath, "/sys")) - util_strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); + strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); else - util_strscpy(filename, sizeof(filename), syspath); + strscpy(filename, sizeof(filename), syspath); util_remove_trailing_chars(filename, '/'); dev = udev_device_new_from_syspath(udev, filename); diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index 2d8aa7913e..df1409bff6 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -66,11 +66,11 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) action = optarg; break; case 'N': - if (strcmp (optarg, "early") == 0) { + if (streq (optarg, "early")) { resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { + } else if (streq (optarg, "late")) { resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { + } else if (streq (optarg, "never")) { resolve_names = -1; } else { fprintf(stderr, "resolve-names must be early, late or never\n"); @@ -113,9 +113,9 @@ static int adm_test(struct udev *udev, int argc, char *argv[]) /* add /sys if needed */ if (!startswith(syspath, "/sys")) - util_strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); + strscpyl(filename, sizeof(filename), "/sys", syspath, NULL); else - util_strscpy(filename, sizeof(filename), syspath); + strscpy(filename, sizeof(filename), syspath); util_remove_trailing_chars(filename, '/'); dev = udev_device_new_from_syspath(udev, filename); diff --git a/src/udev/udevadm-trigger.c b/src/udev/udevadm-trigger.c index d8960f997d..f472996965 100644 --- a/src/udev/udevadm-trigger.c +++ b/src/udev/udevadm-trigger.c @@ -48,7 +48,7 @@ static void exec_list(struct udev_enumerate *udev_enumerate, const char *action) printf("%s\n", udev_list_entry_get_name(entry)); if (dry_run) continue; - util_strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); + strscpyl(filename, sizeof(filename), udev_list_entry_get_name(entry), "/uevent", NULL); fd = open(filename, O_WRONLY); if (fd < 0) continue; @@ -62,7 +62,7 @@ static const char *keyval(const char *str, const char **val, char *buf, size_t s { char *pos; - util_strscpy(buf, size,str); + strscpy(buf, size,str); pos = strchr(buf, '='); if (pos != NULL) { pos[0] = 0; @@ -122,9 +122,9 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) dry_run = 1; break; case 't': - if (strcmp(optarg, "devices") == 0) { + if (streq(optarg, "devices")) { device_type = TYPE_DEVICES; - } else if (strcmp(optarg, "subsystems") == 0) { + } else if (streq(optarg, "subsystems")) { device_type = TYPE_SUBSYSTEMS; } else { log_error("unknown type --type=%s\n", optarg); @@ -165,9 +165,9 @@ static int adm_trigger(struct udev *udev, int argc, char *argv[]) /* add sys dir if needed */ if (!startswith(optarg, "/sys")) - util_strscpyl(path, sizeof(path), "/sys", optarg, NULL); + strscpyl(path, sizeof(path), "/sys", optarg, NULL); else - util_strscpy(path, sizeof(path), optarg); + strscpy(path, sizeof(path), optarg); util_remove_trailing_chars(path, '/'); dev = udev_device_new_from_syspath(udev, path); if (dev == NULL) { diff --git a/src/udev/udevadm.c b/src/udev/udevadm.c index 82852fb086..e7e1b4a978 100644 --- a/src/udev/udevadm.c +++ b/src/udev/udevadm.c @@ -130,7 +130,7 @@ int main(int argc, char *argv[]) if (command != NULL) for (i = 0; i < ELEMENTSOF(udevadm_cmds); i++) { - if (strcmp(udevadm_cmds[i]->name, command) == 0) { + if (streq(udevadm_cmds[i]->name, command)) { argc -= optind; argv += optind; /* we need '0' here to reset the internal state */ diff --git a/src/udev/udevd.c b/src/udev/udevd.c index 0fb7915b70..44318814c9 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -503,7 +503,7 @@ static bool is_devpath_busy(struct event *event) return true; /* check our old name */ - if (event->devpath_old != NULL && strcmp(loop_event->devpath, event->devpath_old) == 0) { + if (event->devpath_old != NULL && streq(loop_event->devpath, event->devpath_old)) { event->delaying_seqnum = loop_event->seqnum; return true; } @@ -732,7 +732,7 @@ static int handle_inotify(struct udev *udev) int fd; log_debug("device %s closed, synthesising 'change'\n", udev_device_get_devnode(dev)); - util_strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); + strscpyl(filename, sizeof(filename), udev_device_get_syspath(dev), "/uevent", NULL); fd = open(filename, O_WRONLY); if (fd >= 0) { if (write(fd, "change", 6) < 0) @@ -823,7 +823,7 @@ static void static_dev_create_from_modules(struct udev *udev) return; } - util_strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL); + strscpyl(modules, sizeof(modules), ROOTPREFIX "/lib/modules/", kernel.release, "/modules.devname", NULL); f = fopen(modules, "re"); if (f == NULL) return; @@ -870,7 +870,7 @@ static void static_dev_create_from_modules(struct udev *udev) else continue; - util_strscpyl(filename, sizeof(filename), "/dev/", devname, NULL); + strscpyl(filename, sizeof(filename), "/dev/", devname, NULL); mkdir_parents_label(filename, 0755); label_context_set(filename, mode); log_debug("mknod '%s' %c%u:%u\n", filename, type, maj, min); @@ -983,11 +983,11 @@ int main(int argc, char *argv[]) udev_set_log_priority(udev, LOG_DEBUG); break; case 'N': - if (strcmp (optarg, "early") == 0) { + if (streq(optarg, "early")) { resolve_names = 1; - } else if (strcmp (optarg, "late") == 0) { + } else if (streq(optarg, "late")) { resolve_names = 0; - } else if (strcmp (optarg, "never") == 0) { + } else if (streq(optarg, "never")) { resolve_names = -1; } else { fprintf(stderr, "resolve-names must be early, late or never\n"); @@ -1116,7 +1116,7 @@ int main(int argc, char *argv[]) write_one_line_file("/proc/self/oom_score_adj", "-1000"); } - print_kmsg("starting eudev version " VERSION "\n"); + print_kmsg("starting version " VERSION "\n"); if (!debug) { int fd; |