summaryrefslogtreecommitdiffstats
path: root/src/udev/udevadm-test-builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udev/udevadm-test-builtin.c')
-rw-r--r--src/udev/udevadm-test-builtin.c18
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;