summaryrefslogtreecommitdiffstats
path: root/src/udev/udev-rules.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udev-rules.c')
-rw-r--r--src/udev/udev-rules.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index b353b5b810..a610dea0d9 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -1740,7 +1740,7 @@ static int udev_rule_apply_token_to_event(
log_rule_debug(dev, rules, "Running PROGRAM '%s'", buf);
- r = udev_event_spawn(event, timeout_usec, timeout_signal, true, buf, result, sizeof(result));
+ r = udev_event_spawn(event, timeout_usec, timeout_signal, true, buf, result, sizeof(result), NULL);
if (r != 0) {
if (r < 0)
log_rule_warning_errno(dev, rules, r, "Failed to execute \"%s\": %m", buf);
@@ -1826,7 +1826,7 @@ static int udev_rule_apply_token_to_event(
log_rule_debug(dev, rules, "Importing properties from results of '%s'", buf);
- r = udev_event_spawn(event, timeout_usec, timeout_signal, true, buf, result, sizeof result);
+ r = udev_event_spawn(event, timeout_usec, timeout_signal, true, buf, result, sizeof result, &truncated);
if (r != 0) {
if (r < 0)
log_rule_warning_errno(dev, rules, r, "Failed to execute '%s', ignoring: %m", buf);
@@ -1835,6 +1835,18 @@ static int udev_rule_apply_token_to_event(
return token->op == OP_NOMATCH;
}
+ if (truncated) {
+ bool found = false;
+
+ /* Drop the last line. */
+ for (char *p = buf + strlen(buf) - 1; p >= buf; p--)
+ if (strchr(NEWLINE, *p)) {
+ *p = '\0';
+ found = true;
+ } else if (found)
+ break;
+ }
+
r = strv_split_newlines_full(&lines, result, EXTRACT_RETAIN_ESCAPE);
if (r < 0)
log_rule_warning_errno(dev, rules, r,