diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:42 +0000 |
commit | 78e9bb837c258ac0ec7712b3d612cc2f407e731e (patch) | |
tree | f515d16b6efd858a9aeb5b0ef5d6f90bf288283d /src/udev/udevadm-test-builtin.c | |
parent | Adding debian version 255.5-1. (diff) | |
download | systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.tar.xz systemd-78e9bb837c258ac0ec7712b3d612cc2f407e731e.zip |
Merging upstream version 256.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/udev/udevadm-test-builtin.c')
-rw-r--r-- | src/udev/udevadm-test-builtin.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/src/udev/udevadm-test-builtin.c b/src/udev/udevadm-test-builtin.c index 088b4da..322f627 100644 --- a/src/udev/udevadm-test-builtin.c +++ b/src/udev/udevadm-test-builtin.c @@ -6,6 +6,8 @@ #include <stdio.h> #include <stdlib.h> +#include "device-private.h" +#include "device-util.h" #include "log.h" #include "udev-builtin.h" #include "udevadm.h" @@ -77,8 +79,7 @@ int builtin_main(int argc, char *argv[], void *userdata) { UdevBuiltinCommand cmd; int r; - log_set_max_level(LOG_DEBUG); - log_parse_environment(); + log_setup(); r = parse_argv(argc, argv); if (r <= 0) @@ -98,13 +99,22 @@ int builtin_main(int argc, char *argv[], void *userdata) { goto finish; } - event = udev_event_new(dev, 0, NULL, LOG_DEBUG); + event = udev_event_new(dev, NULL, EVENT_UDEVADM_TEST_BUILTIN); if (!event) { r = log_oom(); goto finish; } - r = udev_builtin_run(event, cmd, arg_command, true); + if (arg_action != SD_DEVICE_REMOVE) { + /* For net_setup_link */ + r = device_clone_with_db(dev, &event->dev_db_clone); + if (r < 0) { + log_device_error_errno(dev, r, "Failed to clone device: %m"); + goto finish; + } + } + + r = udev_builtin_run(event, cmd, arg_command); if (r < 0) { log_debug_errno(r, "Builtin command '%s' fails: %m", arg_command); goto finish; |