summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-11 17:32:59 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-11 17:32:59 +0200
commit27f877e60f1c1793d6fafdd888e7e367c44b2eb9 (patch)
tree9c44dd776b7799bae3bfcf6ea445bb59c1a4605f /udev_rules.c
parent7fd0de4984deac2e51f9b85c156f200beadbc7ef (diff)
allow logging of all output from executed tools
If USE_DEBUG=true and udev_log="debug", all output of the forked programs to stdout and stderr is send to syslog. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/udev_rules.c b/udev_rules.c
index d42b219d7d..8587b02549 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -27,6 +27,7 @@
#include <ctype.h>
#include <unistd.h>
#include <errno.h>
+#include <syslog.h>
#include <sys/wait.h>
#include <sys/stat.h>
@@ -221,7 +222,7 @@ static int import_program_into_env(struct udevice *udev, const char *program)
char result[1024];
size_t reslen;
- if (execute_program(program, udev->subsystem, result, sizeof(result), &reslen) != 0)
+ if (run_program(program, udev->subsystem, result, sizeof(result), &reslen, (udev_log_priority >= LOG_DEBUG)) != 0)
return -1;
return import_keys_into_env(udev, result, reslen);
}
@@ -833,8 +834,9 @@ try_parent:
strlcpy(program, key_val(rule, &rule->program), sizeof(program));
apply_format(udev, program, sizeof(program), class_dev, sysfs_device);
dbg("check for PROGRAM program='%s", program);
- if (execute_program(program, udev->subsystem, result, sizeof(result), NULL) != 0) {
+ if (run_program(program, udev->subsystem, result, sizeof(result), NULL, (udev_log_priority >= LOG_DEBUG)) != 0) {
dbg("PROGRAM is false");
+ udev->program_result[0] = '\0';
if (rule->program.operation != KEY_OP_NOMATCH)
goto exit;
} else {