diff options
author | Kay Sievers <kay@vrfy.org> | 2013-01-09 19:06:46 +0100 |
---|---|---|
committer | Kay Sievers <kay@vrfy.org> | 2013-01-09 19:06:46 +0100 |
commit | d5a89d7dc17a5ba5cf4fc71f82963c5c94a31c3d (patch) | |
tree | 6b1c9b2355d2f40fd083eb91411748310a3308dd /src/udev | |
parent | 0908dd2fd5536cf15d75780980ac2eca37ff800f (diff) |
udev: move string copy functions to shared/
Diffstat (limited to 'src/udev')
-rw-r--r-- | src/udev/collect/collect.c | 2 | ||||
-rw-r--r-- | src/udev/scsi_id/scsi_id.c | 8 | ||||
-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 | 10 | ||||
-rw-r--r-- | src/udev/udev-builtin-net_id.c | 20 | ||||
-rw-r--r-- | src/udev/udev-builtin-usb_id.c | 10 | ||||
-rw-r--r-- | src/udev/udev-builtin.c | 4 | ||||
-rw-r--r-- | src/udev/udev-ctrl.c | 4 | ||||
-rw-r--r-- | src/udev/udev-event.c | 58 | ||||
-rw-r--r-- | src/udev/udev-node.c | 14 | ||||
-rw-r--r-- | src/udev/udev-rules.c | 28 | ||||
-rw-r--r-- | src/udev/udevadm-info.c | 4 | ||||
-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 | 4 | ||||
-rw-r--r-- | src/udev/udevadm-trigger.c | 8 | ||||
-rw-r--r-- | src/udev/udevd.c | 14 |
18 files changed, 99 insertions, 99 deletions
diff --git a/src/udev/collect/collect.c b/src/udev/collect/collect.c index 3c46e40de1..f594814dbe 100644 --- a/src/udev/collect/collect.c +++ b/src/udev/collect/collect.c @@ -414,7 +414,7 @@ int main(int argc, char **argv) if (debug) fprintf(stderr, "Using checkpoint '%s'\n", checkpoint); - util_strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL); + strscpyl(tmpdir, sizeof(tmpdir), "/run/udev/collect", NULL); fd = prepare(tmpdir, checkpoint); if (fd < 0) { ret = 3; diff --git a/src/udev/scsi_id/scsi_id.c b/src/udev/scsi_id/scsi_id.c index c90b6aa581..fa0413c462 100644 --- a/src/udev/scsi_id/scsi_id.c +++ b/src/udev/scsi_id/scsi_id.c @@ -108,7 +108,7 @@ static void set_type(const char *from, char *to, size_t len) break; } } - util_strscpy(to, len, type); + strscpy(to, len, type); } /* @@ -341,7 +341,7 @@ static int set_options(struct udev *udev, case 'd': dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, optarg); + strscpy(maj_min_dev, MAX_PATH_LEN, optarg); break; case 'e': @@ -349,7 +349,7 @@ static int set_options(struct udev *udev, break; case 'f': - util_strscpy(config_file, MAX_PATH_LEN, optarg); + strscpy(config_file, MAX_PATH_LEN, optarg); break; case 'g': @@ -415,7 +415,7 @@ static int set_options(struct udev *udev, } if (optind < argc && !dev_specified) { dev_specified = 1; - util_strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); + strscpy(maj_min_dev, MAX_PATH_LEN, argv[optind]); } return 0; } diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c index 4293103046..56a05f5e50 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); } } 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 4a91d33575..9cb4294633 100644 --- a/src/udev/udev-builtin-firmware.c +++ b/src/udev/udev-builtin-firmware.c @@ -100,20 +100,20 @@ 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_path_encode(firmware, fwencpath, sizeof(fwencpath)); - util_strscpyl(misspath, sizeof(misspath), "/run/udev/firmware-missing/", fwencpath, NULL); - util_strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); + strscpyl(misspath, sizeof(misspath), "/run/udev/firmware-missing/", fwencpath, NULL); + strscpyl(loadpath, sizeof(loadpath), udev_device_get_syspath(dev), "/loading", NULL); if (fwfile == NULL) { int err; @@ -152,7 +152,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-net_id.c b/src/udev/udev-builtin-net_id.c index 7c9564f4cd..a5da291497 100644 --- a/src/udev/udev-builtin-net_id.c +++ b/src/udev/udev-builtin-net_id.c @@ -183,11 +183,11 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { /* compose a name based on the raw kernel's PCI bus, slot numbers */ s = names->pci_path; - l = util_strpcpyf(&s, sizeof(names->pci_path), "p%ds%d", bus, slot); + l = strpcpyf(&s, sizeof(names->pci_path), "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'; @@ -231,11 +231,11 @@ static int dev_pci_slot(struct udev_device *dev, struct netnames *names) { if (hotplug_slot > 0) { s = names->pci_slot; - l = util_strpcpyf(&s, sizeof(names->pci_slot), "s%d", hotplug_slot); + l = strpcpyf(&s, sizeof(names->pci_slot), "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'; } @@ -277,7 +277,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(names->usbdev)); + strscpy(name, sizeof(name), udev_device_get_sysname(names->usbdev)); s = strchr(name, '-'); if (!s) return -EINVAL; @@ -300,15 +300,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; diff --git a/src/udev/udev-builtin-usb_id.c b/src/udev/udev-builtin-usb_id.c index 13d1226393..7ce401d152 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 @@ -438,12 +438,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 32e6e1e90c..0651ae2ff0 100644 --- a/src/udev/udev-builtin.c +++ b/src/udev/udev-builtin.c @@ -110,7 +110,7 @@ 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'; @@ -128,7 +128,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 a235912ffb..6ee6b04b1b 100644 --- a/src/udev/udev-ctrl.c +++ b/src/udev/udev-ctrl.c @@ -93,7 +93,7 @@ struct udev_ctrl *udev_ctrl_new_from_fd(struct udev *udev, int fd) } 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; } @@ -250,7 +250,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 5eedf4f0df..8c8b058df7 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 */ @@ -688,7 +688,7 @@ int udev_event_spawn(struct udev_event *event, /* allow programs in /usr/lib/udev/ to be called without the path */ if (argv[0][0] != '/') { - util_strscpyl(program, sizeof(program), UDEVLIBEXECDIR "/", argv[0], NULL); + strscpyl(program, sizeof(program), UDEVLIBEXECDIR "/", argv[0], NULL); argv[0] = program; } @@ -763,8 +763,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); if (err >= 0) { print_kmsg("renamed network interface %s to %s\n", ifr.ifr_name, ifr.ifr_newname); @@ -825,11 +825,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 1e378adf29..3eec14021b 100644 --- a/src/udev/udev-node.c +++ b/src/udev/udev-node.c @@ -55,10 +55,10 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) 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; @@ -101,7 +101,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink) } log_debug("atomically replace '%s'\n", slink); - util_strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); + strscpyl(slink_tmp, sizeof(slink_tmp), slink, TMP_FILE_EXT, NULL); unlink(slink_tmp); do { err = mkdir_parents_label(slink_tmp, 0755); @@ -136,7 +136,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; } @@ -169,7 +169,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; } } @@ -191,8 +191,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); diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c index 9743243a37..bb57d2af48 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; @@ -1752,7 +1752,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, '|'); @@ -1819,7 +1819,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])) @@ -2015,8 +2015,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); } } @@ -2328,7 +2328,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)); @@ -2419,7 +2419,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++; @@ -2429,7 +2429,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; @@ -2441,7 +2441,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)); @@ -2539,7 +2539,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 95f077ca95..d6f82869b1 100644 --- a/src/udev/udevadm-info.c +++ b/src/udev/udevadm-info.c @@ -269,7 +269,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; } @@ -414,7 +414,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..f22a2c32cc 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -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 d52ae461fe..4d96a786c3 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; @@ -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/udevd.c b/src/udev/udevd.c index ffc48a03bd..9f184621ae 100644 --- a/src/udev/udevd.c +++ b/src/udev/udevd.c @@ -726,7 +726,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) @@ -813,7 +813,7 @@ static void static_dev_create_from_modules(struct udev *udev) FILE *f; uname(&kernel); - 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; @@ -860,7 +860,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); @@ -909,7 +909,7 @@ static int convert_db(struct udev *udev) mkdir_p("/run/udev/data", 0755); /* old database */ - util_strscpyl(filename, sizeof(filename), "/dev/.udev/db", NULL); + strscpyl(filename, sizeof(filename), "/dev/.udev/db", NULL); if (access(filename, F_OK) < 0) return 0; @@ -938,7 +938,7 @@ static int convert_db(struct udev *udev) /* find database in old location */ id = udev_device_get_id_filename(device); - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", id, NULL); + strscpyl(from, sizeof(from), "/dev/.udev/db/", id, NULL); if (lstat(from, &stats) == 0) { if (!have_db) { udev_device_read_db(device, from); @@ -948,7 +948,7 @@ static int convert_db(struct udev *udev) } /* find old database with $subsys:$sysname name */ - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", + strscpyl(from, sizeof(from), "/dev/.udev/db/", udev_device_get_subsystem(device), ":", udev_device_get_sysname(device), NULL); if (lstat(from, &stats) == 0) { if (!have_db) { @@ -960,7 +960,7 @@ static int convert_db(struct udev *udev) /* find old database with the encoded devpath name */ util_path_encode(udev_device_get_devpath(device), devpath, sizeof(devpath)); - util_strscpyl(from, sizeof(from), "/dev/.udev/db/", devpath, NULL); + strscpyl(from, sizeof(from), "/dev/.udev/db/", devpath, NULL); if (lstat(from, &stats) == 0) { if (!have_db) { udev_device_read_db(device, from); |