#include <ctype.h>
#include <signal.h>
+#include "libsysfs/sysfs/libsysfs.h"
#include "udev.h"
#include "udev_version.h"
#include "udev_dbus.h"
#include "logging.h"
#include "namedev.h"
#include "udevdb.h"
-#include "libsysfs/libsysfs.h"
/* 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)
{
action = get_action();
if (!action) {
- dbg ("no action?");
+ dbg("no action?");
goto exit;
}
devpath = get_devpath();
if (!devpath) {
- dbg ("no devpath?");
+ dbg("no devpath?");
goto exit;
}
dbg("looking at '%s'", devpath);
/* skip blacklisted subsystems */
subsystem = argv[1];
+ if (!subsystem) {
+ dbg("no subsystem?");
+ goto exit;
+ }
i = 0;
while (subsystem_blacklist[i][0] != '\0') {
if (strcmp(subsystem, subsystem_blacklist[i]) == 0) {
namedev_init();
if (strcmp(action, "add") == 0)
- retval = udev_add_device(devpath, subsystem);
+ retval = udev_add_device(devpath, subsystem, 0);
else if (strcmp(action, "remove") == 0)
retval = udev_remove_device(devpath, subsystem);