diff options
author | Kay Sievers <kay.sievers@vrfy.org> | 2007-07-14 20:43:43 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@vrfy.org> | 2007-07-14 20:43:43 +0200 |
commit | fb819f5554530dd136d50aa40438e9dbeeceac01 (patch) | |
tree | c8a50c6c58ab6010dc63af0035e552119a5e8f28 | |
parent | 4110664d4f25f203b7d76ee56e5e23220b04eb69 (diff) |
use global udev_log variable instead of parameter in run_program
-rw-r--r-- | test-udev.c | 2 | ||||
-rw-r--r-- | udev.h | 2 | ||||
-rw-r--r-- | udev_rules.c | 5 | ||||
-rw-r--r-- | udev_utils_run.c | 9 | ||||
-rw-r--r-- | udevd.c | 3 | ||||
-rw-r--r-- | udevstart.c | 2 |
6 files changed, 11 insertions, 12 deletions
diff --git a/test-udev.c b/test-udev.c index ba36015911..f114609e5b 100644 --- a/test-udev.c +++ b/test-udev.c @@ -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); } } } @@ -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 diff --git a/udev_rules.c b/udev_rules.c index b2b4809d79..9483c2b8f8 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -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) diff --git a/udev_utils_run.c b/udev_utils_run.c index 1a92cddd8a..69b54f47a7 100644 --- a/udev_utils_run.c +++ b/udev_utils_run.c @@ -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; @@ -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; } diff --git a/udevstart.c b/udevstart.c index 6af5860e27..1e67a0615a 100644 --- a/udevstart.c +++ b/udevstart.c @@ -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); } } } |