From f6caab8995a27244db185f075e751a119e4bdedc Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 14 Dec 2021 08:05:41 +0900 Subject: udev: warn when result of string substitution is truncated --- src/udev/udevadm-test.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/udev/udevadm-test.c') diff --git a/src/udev/udevadm-test.c b/src/udev/udevadm-test.c index 01057e1256..8adebbc83e 100644 --- a/src/udev/udevadm-test.c +++ b/src/udev/udevadm-test.c @@ -135,8 +135,11 @@ int test_main(int argc, char *argv[], void *userdata) { ORDERED_HASHMAP_FOREACH_KEY(val, cmd, event->run_list) { char program[UDEV_PATH_SIZE]; + bool truncated; - (void) udev_event_apply_format(event, cmd, program, sizeof(program), false); + (void) udev_event_apply_format(event, cmd, program, sizeof(program), false, &truncated); + if (truncated) + log_warning("The command '%s' is truncated while substituting into '%s'.", program, cmd); printf("run: '%s'\n", program); } -- cgit v1.2.1