diff options
-rw-r--r-- | logging.h | 18 | ||||
-rw-r--r-- | udev.c | 15 | ||||
-rw-r--r-- | udevd.c | 11 | ||||
-rw-r--r-- | udevinfo.c | 12 | ||||
-rw-r--r-- | udevsend.c | 11 |
5 files changed, 40 insertions, 27 deletions
@@ -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) @@ -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) { @@ -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) { |