]> err.no Git - systemd/commitdiff
use global udev_log variable instead of parameter in run_program
authorKay Sievers <kay.sievers@vrfy.org>
Sat, 14 Jul 2007 18:43:43 +0000 (20:43 +0200)
committerKay Sievers <kay.sievers@vrfy.org>
Sat, 14 Jul 2007 18:43:43 +0000 (20:43 +0200)
test-udev.c
udev.h
udev_rules.c
udev_utils_run.c
udevd.c
udevstart.c

index ba3601591146bc8f810c6a08234e46b3510083c7..f114609e5bca0379eae5eea0cc1540531ab41ac3 100644 (file)
@@ -166,7 +166,7 @@ int main(int argc, char *argv[], char *envp[])
 
                                strlcpy(program, name_loop->name, sizeof(program));
                                udev_rules_apply_format(udev, program, sizeof(program));
-                               run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
+                               run_program(program, udev->dev->subsystem, NULL, 0, NULL);
                        }
                }
        }
diff --git a/udev.h b/udev.h
index baf58a81632b4232e98cd1d68fc97a325f59cf51..c056835f39b3a78e8fab182488ffa2ce856b2964 100644 (file)
--- a/udev.h
+++ b/udev.h
@@ -169,6 +169,6 @@ extern size_t buf_get_line(const char *buf, size_t buflen, size_t cur);
 /* udev_utils_run.c */
 extern int pass_env_to_socket(const char *name, const char *devpath, const char *action);
 extern int run_program(const char *command, const char *subsystem,
-                      char *result, size_t ressize, size_t *reslen, int log);
+                      char *result, size_t ressize, size_t *reslen);
 
 #endif
index b2b4809d7912d03dad1739f3df8b13ee00859281..9483c2b8f8fd0bcfd725a10c1b519ce65e5ac407 100644 (file)
@@ -190,7 +190,7 @@ static int import_program_into_env(struct udevice *udev, const char *program)
        char result[2048];
        size_t reslen;
 
-       if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_INFO)) != 0)
+       if (run_program(program, udev->dev->subsystem, result, sizeof(result), &reslen) != 0)
                return -1;
        return import_keys_into_env(udev, result, reslen);
 }
@@ -837,8 +837,7 @@ try_parent:
 
                strlcpy(program, key_val(rule, &rule->program), sizeof(program));
                udev_rules_apply_format(udev, program, sizeof(program));
-               if (run_program(program, udev->dev->subsystem, result, sizeof(result),
-                               NULL, (udev_log_priority >= LOG_INFO)) != 0) {
+               if (run_program(program, udev->dev->subsystem, result, sizeof(result), NULL) != 0) {
                        dbg("PROGRAM is false");
                        udev->program_result[0] = '\0';
                        if (rule->program.operation != KEY_OP_NOMATCH)
index 1a92cddd8a28aed1d795f953474a2201f9d157e6..69b54f47a79e3400380701ff0dc15433d43da6ec 100644 (file)
@@ -24,6 +24,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <ctype.h>
+#include <syslog.h>
 #include <sys/socket.h>
 #include <sys/un.h>
 #include <sys/wait.h>
@@ -69,9 +70,8 @@ int pass_env_to_socket(const char *sockname, const char *devpath, const char *ac
 }
 
 int run_program(const char *command, const char *subsystem,
-               char *result, size_t ressize, size_t *reslen, int log)
+               char *result, size_t ressize, size_t *reslen)
 {
-       int retval = 0;
        int status;
        int outpipe[2] = {-1, -1};
        int errpipe[2] = {-1, -1};
@@ -81,6 +81,7 @@ int run_program(const char *command, const char *subsystem,
        char *argv[(sizeof(arg) / 2) + 1];
        int devnull;
        int i;
+       int retval = 0;
 
        /* build argv from comand */
        strlcpy(arg, command, sizeof(arg));
@@ -109,13 +110,13 @@ int run_program(const char *command, const char *subsystem,
        info("'%s'", command);
 
        /* prepare pipes from child to parent */
-       if (result || log) {
+       if (result != NULL || udev_log_priority >= LOG_INFO) {
                if (pipe(outpipe) != 0) {
                        err("pipe failed: %s", strerror(errno));
                        return -1;
                }
        }
-       if (log) {
+       if (udev_log_priority >= LOG_INFO) {
                if (pipe(errpipe) != 0) {
                        err("pipe failed: %s", strerror(errno));
                        return -1;
diff --git a/udevd.c b/udevd.c
index afefb9148351681f08ced949a1b0c0df4fa24ad6..5ed8e38c98dd3073641ce0c82101e5e69280efd6 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -147,8 +147,7 @@ static int udev_event_process(struct udevd_uevent_msg *msg)
 
                                strlcpy(program, name_loop->name, sizeof(program));
                                udev_rules_apply_format(udev, program, sizeof(program));
-                               if (run_program(program, udev->dev->subsystem, NULL, 0, NULL,
-                                               (udev_log_priority >= LOG_INFO)) != 0)
+                               if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0)
                                        if (!name_loop->ignore_error)
                                                retval = -1;
                        }
index 6af5860e27e99cd1f3e641a396b148cf3f80d82c..1e67a0615a9f79a5fd0a4657bc04e0233fce9bb2 100644 (file)
@@ -160,7 +160,7 @@ static int add_device(const char *devpath)
 
                                strlcpy(program, name_loop->name, sizeof(program));
                                udev_rules_apply_format(udev, program, sizeof(program));
-                               run_program(program, udev->dev->subsystem, NULL, 0, NULL, (udev_log_priority >= LOG_INFO));
+                               run_program(program, udev->dev->subsystem, NULL, 0, NULL);
                        }
                }
        }