chiark / gitweb /
rules: implement TAGS== match
[elogind.git] / udev / udevadm.c
index 452489a0c752c4087fcf52be4772cfe770e33197..2a2915891797dcba2b17940ed7db701722b7e7e4 100644 (file)
@@ -25,7 +25,7 @@
 
 #include "udev.h"
 
-static int debug;
+static bool debug;
 
 static void log_fn(struct udev *udev, int priority,
                   const char *file, int line, const char *fn,
@@ -35,6 +35,11 @@ static void log_fn(struct udev *udev, int priority,
                fprintf(stderr, "%s: ", fn);
                vfprintf(stderr, format, args);
        } else {
+               va_list args2;
+
+               va_copy(args2, args);
+               vfprintf(stderr, format, args2);
+               va_end(args2);
                vsyslog(priority, format, args);
        }
 }
@@ -96,7 +101,7 @@ static const struct command cmds[] = {
                .name = "test",
                .cmd = udevadm_test,
                .help = "simulation run",
-               .debug = 1,
+               .debug = true,
        },
        {
                .name = "version",
@@ -112,7 +117,7 @@ static const struct command cmds[] = {
 static int run_command(struct udev *udev, const struct command *cmd, int argc, char *argv[])
 {
        if (cmd->debug) {
-               debug = 1;
+               debug = true;
                if (udev_get_log_priority(udev) < LOG_INFO)
                        udev_set_log_priority(udev, LOG_INFO);
        }
@@ -141,7 +146,7 @@ int main(int argc, char *argv[])
        udev_set_log_fn(udev, log_fn);
        udev_selinux_init(udev);
 
-       while (1) {
+       for (;;) {
                int option;
 
                option = getopt_long(argc, argv, "+dhV", options, NULL);
@@ -150,7 +155,7 @@ int main(int argc, char *argv[])
 
                switch (option) {
                case 'd':
-                       debug = 1;
+                       debug = true;
                        if (udev_get_log_priority(udev) < LOG_INFO)
                                udev_set_log_priority(udev, LOG_INFO);
                        break;
@@ -166,6 +171,8 @@ int main(int argc, char *argv[])
        }
        command = argv[optind];
 
+       info(udev, "runtime dir '%s'\n", udev_get_run_path(udev));
+
        if (command != NULL)
                for (i = 0; cmds[i].cmd != NULL; i++) {
                        if (strcmp(cmds[i].name, command) == 0) {