summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--logging.h18
-rw-r--r--udev.c15
-rw-r--r--udevd.c11
-rw-r--r--udevinfo.c12
-rw-r--r--udevsend.c11
5 files changed, 40 insertions, 27 deletions
diff --git a/logging.h b/logging.h
index df0d7dedce..2ba2ac4965 100644
--- a/logging.h
+++ b/logging.h
@@ -57,23 +57,11 @@
} while (0)
#endif
-/* each program must declare this variable and function somewhere */
-extern unsigned char logname[42];
-extern int log_ok(void);
-
-static void log_message (int level, const char *format, ...)
+extern void log_message (int level, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));
-static inline void log_message (int level, const char *format, ...)
-{
- va_list args;
- if (!log_ok())
- return;
-
- va_start(args, format);
- vsyslog(level, format, args);
- va_end(args);
-}
+/* each program that uses syslog must declare this variable somewhere */
+extern unsigned char logname[42];
#undef init_logging
static inline void init_logging(char *program_name)
diff --git a/udev.c b/udev.c
index 0f01fa41d2..9f10cc2125 100644
--- a/udev.c
+++ b/udev.c
@@ -38,12 +38,21 @@
/* global variables */
char **main_argv;
char **main_envp;
-unsigned char logname[42];
-int log_ok(void)
+#ifdef LOG
+unsigned char logname[42];
+void log_message (int level, const char *format, ...)
{
- return udev_log;
+ va_list args;
+
+ if (!udev_log)
+ return;
+
+ va_start(args, format);
+ vsyslog(level, format, args);
+ va_end(args);
}
+#endif
static void sig_handler(int signum)
{
diff --git a/udevd.c b/udevd.c
index 14616b9824..9fbb4e964b 100644
--- a/udevd.c
+++ b/udevd.c
@@ -51,12 +51,17 @@ LIST_HEAD(running_list);
static void exec_queue_manager(void);
static void msg_queue_manager(void);
+#ifdef LOG
unsigned char logname[42];
-
-int log_ok(void)
+void log_message (int level, const char *format, ...)
{
- return 1;
+ va_list args;
+
+ va_start(args, format);
+ vsyslog(level, format, args);
+ va_end(args);
}
+#endif
static void msg_dump_queue(void)
{
diff --git a/udevinfo.c b/udevinfo.c
index 103ebce08c..44eb142709 100644
--- a/udevinfo.c
+++ b/udevinfo.c
@@ -38,12 +38,18 @@
char **main_argv;
int main_argc;
-unsigned char logname[42];
-int log_ok(void)
+#ifdef LOG
+unsigned char logname[42];
+void log_message (int level, const char *format, ...)
{
- return 1;
+ va_list args;
+
+ va_start(args, format);
+ vsyslog(level, format, args);
+ va_end(args);
}
+#endif
static int print_all_attributes(const char *path)
{
diff --git a/udevsend.c b/udevsend.c
index b2fbcbbca6..c738fe2245 100644
--- a/udevsend.c
+++ b/udevsend.c
@@ -40,12 +40,17 @@
#include "udevd.h"
#include "logging.h"
+#ifdef LOG
unsigned char logname[42];
-
-int log_ok(void)
+void log_message (int level, const char *format, ...)
{
- return 1;
+ va_list args;
+
+ va_start(args, format);
+ vsyslog(level, format, args);
+ va_end(args);
}
+#endif
static inline char *get_action(void)
{