summaryrefslogtreecommitdiff
path: root/udev/udevadm-test.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-05-20 17:57:52 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-05-20 17:57:52 +0200
commit065db052211d3bf08d9b0f698a79a8798faf11d2 (patch)
tree970ac911636e2711c99ab050a7fd341e95ea08a9 /udev/udevadm-test.c
parentf58a9099bb2b18f3f683615324a4382b95446305 (diff)
use more efficient string copying
Diffstat (limited to 'udev/udevadm-test.c')
-rw-r--r--udev/udevadm-test.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/udev/udevadm-test.c b/udev/udevadm-test.c
index c53c273295..e49d52c5f1 100644
--- a/udev/udevadm-test.c
+++ b/udev/udevadm-test.c
@@ -91,12 +91,10 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
}
/* add /sys if needed */
- if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0) {
- util_strlcpy(filename, udev_get_sys_path(udev), sizeof(filename));
- util_strlcat(filename, syspath, sizeof(filename));
- } else {
- util_strlcpy(filename, syspath, sizeof(filename));
- }
+ if (strncmp(syspath, udev_get_sys_path(udev), strlen(udev_get_sys_path(udev))) != 0)
+ util_strscpyl(filename, sizeof(filename), udev_get_sys_path(udev), syspath, NULL);
+ else
+ util_strscpy(filename, sizeof(filename), syspath);
util_remove_trailing_chars(filename, '/');
dev = udev_device_new_from_syspath(udev, filename);
@@ -123,8 +121,7 @@ int udevadm_test(struct udev *udev, int argc, char *argv[])
udev_list_entry_foreach(entry, udev_list_get_entry(&event->run_list)) {
char program[UTIL_PATH_SIZE];
- util_strlcpy(program, udev_list_entry_get_name(entry), sizeof(program));
- udev_event_apply_format(event, program, sizeof(program));
+ udev_event_apply_format(event, udev_list_entry_get_name(entry), program, sizeof(program));
info(udev, "run: '%s'\n", program);
}
}