diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-14 08:05:41 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2021-12-25 15:13:17 +0900 |
commit | f6caab8995a27244db185f075e751a119e4bdedc (patch) | |
tree | 0d17633120b8c8dab7209dc3f5e4532738231291 /src/udev/udevadm-test.c | |
parent | 648a799fc9c2f6be07a08fb643f3405c0d3647b6 (diff) | |
download | systemd-f6caab8995a27244db185f075e751a119e4bdedc.tar.gz |
udev: warn when result of string substitution is truncated
Diffstat (limited to 'src/udev/udevadm-test.c')
-rw-r--r-- | src/udev/udevadm-test.c | 5 |
1 files changed, 4 insertions, 1 deletions
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); } |