/*
* udevinitsend.c
*
- * Userspace devfs
- *
- * Copyright (C) 2004, 2005 Hannes Reinecke <hare@suse.de>
+ * Copyright (C) 2004, 2005 SuSE Linux Products GmbH
+ * Author:
+ * Hannes Reinecke <hare@suse.de>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
#include <stdio.h>
#include <stddef.h>
#include <stdio.h>
+#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "udev.h"
#include "udev_version.h"
#include "udevd.h"
+#include "udev_utils.h"
#include "logging.h"
+static int log = 0;
#ifdef USE_LOG
-void log_message (int level, const char *format, ...)
+void log_message (int priority, const char *format, ...)
{
va_list args;
+ if (priority > log)
+ return;
+
va_start(args, format);
- vsyslog(level, format, args);
+ vsyslog(priority, format, args);
va_end(args);
}
#endif
memset(&usend_msg, 0x00, sizeof(struct udevd_msg));
strcpy(usend_msg.magic, UDEV_MAGIC);
- usend_msg.type = UDEVD_INITSEND;
+ usend_msg.type = UDEVD_UEVENT_INITSEND;
ls = fdmap;
ch = le = ls;
strncpy(&usend_msg.envbuf[bufpos],ls,(ch - ls) + 1);
bufpos += (ch - ls) + 1;
if (ch[1] == '\'' && le[-1] == '\'') {
- strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) -3);
+ strncpy(&usend_msg.envbuf[bufpos],ch + 2, (le - ch) - 3);
bufpos += (le - ch) - 3;
} else {
- strncpy(&usend_msg.envbuf[bufpos],ch, (le - ch));
- bufpos += (le - ch);
+ strncpy(&usend_msg.envbuf[bufpos],ch + 1, (le - ch) - 1);
+ bufpos += (le - ch) - 1;
}
bufpos++;
}
int retval = 1;
int disable_loop_detection = 0;
int sock;
+ const char *env;
+
+ env = getenv("UDEV_LOG");
+ if (env)
+ log = log_priority(env);
logging_init("udevinitsend");
dbg("version %s", UDEV_VERSION);