X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Ftest%2Ftest-udev.c;h=b57d275efa26314e4ed06b5f60fd4ea1a3c4ecf2;hp=bab64c90151c24d9de3e8deb5ab64c0e5051d3a2;hb=b9f111b93f9f442f00266f338b14f25ca8685352;hpb=f168c27313e4d7b0aabee037dc9c78a5799f0597 diff --git a/src/test/test-udev.c b/src/test/test-udev.c index bab64c901..b57d275ef 100644 --- a/src/test/test-udev.c +++ b/src/test/test-udev.c @@ -26,20 +26,16 @@ #include #include #include -#include #include #include #include #include #include "missing.h" +#include "selinux-util.h" #include "udev.h" #include "udev-util.h" -void udev_main_log(struct udev *udev, int priority, - const char *file, int line, const char *fn, - const char *format, va_list args) {} - static int fake_filesystems(void) { static const struct fakefs { const char *src; @@ -80,7 +76,6 @@ out: return err; } - int main(int argc, char *argv[]) { _cleanup_udev_unref_ struct udev *udev = NULL; _cleanup_udev_event_unref_ struct udev_event *event = NULL; @@ -100,20 +95,20 @@ int main(int argc, char *argv[]) { if (udev == NULL) return EXIT_FAILURE; - log_debug("version %s\n", VERSION); - label_init("/dev"); + log_debug("version %s", VERSION); + mac_selinux_init("/dev"); sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); action = argv[1]; if (action == NULL) { - log_error("action missing\n"); + log_error("action missing"); goto out; } devpath = argv[2]; if (devpath == NULL) { - log_error("devpath missing\n"); + log_error("devpath missing"); goto out; } @@ -122,7 +117,7 @@ int main(int argc, char *argv[]) { strscpyl(syspath, sizeof(syspath), "/sys", devpath, NULL); dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { - log_debug("unknown device '%s'\n", devpath); + log_debug("unknown device '%s'", devpath); goto out; } @@ -151,17 +146,22 @@ int main(int argc, char *argv[]) { mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); } else { unlink(udev_device_get_devnode(dev)); - util_delete_path(udev, udev_device_get_devnode(dev)); + rmdir_parents(udev_device_get_devnode(dev), "/"); } } - err = udev_event_execute_rules(event, rules, &sigmask_orig); - if (err == 0) - udev_event_execute_run(event, NULL); + udev_event_execute_rules(event, + 3 * USEC_PER_SEC, USEC_PER_SEC, + NULL, + rules, + &sigmask_orig); + udev_event_execute_run(event, + 3 * USEC_PER_SEC, USEC_PER_SEC, + NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); - label_finish(); + mac_selinux_finish(); return err ? EXIT_FAILURE : EXIT_SUCCESS; }