chiark / gitweb /
[PATCH] catchup with recent klibc
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index d464b9a196fd46506084fb093270d3ba2d416849..5756b46122d0f03037c4b9521679fd53e2b14bab 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -34,9 +34,7 @@
 #include <sys/un.h>
 #include <fcntl.h>
 #include "klibc_fixups.h"
-#ifndef __KLIBC__
 #include <sys/sysinfo.h>
-#endif
 
 #include "list.h"
 #include "udev.h"
@@ -60,6 +58,7 @@ static void exec_queue_manager(void);
 static void msg_queue_manager(void);
 static void user_sighandler(void);
 static void reap_kids(void);
+char *udev_bin;
 
 #ifdef LOG
 unsigned char logname[LOGNAME_SIZE];
@@ -73,6 +72,10 @@ void log_message (int level, const char *format, ...)
 }
 #endif
 
+#define msg_dump(msg) \
+       dbg("msg_dump: sequence %d, '%s', '%s', '%s'", \
+       msg->seqnum, msg->action, msg->devpath, msg->subsystem);
+
 static void msg_dump_queue(void)
 {
 #ifdef DEBUG
@@ -83,12 +86,6 @@ static void msg_dump_queue(void)
 #endif
 }
 
-static void msg_dump(struct hotplug_msg *msg)
-{
-       dbg("sequence %d, '%s', '%s', '%s'",
-           msg->seqnum, msg->action, msg->devpath, msg->subsystem);
-}
-
 static struct hotplug_msg *msg_create(void)
 {
        struct hotplug_msg *new_msg;
@@ -148,7 +145,7 @@ static void udev_run(struct hotplug_msg *msg)
        switch (pid) {
        case 0:
                /* child */
-               execle(UDEV_BIN, "udev", msg->subsystem, NULL, env);
+               execle(udev_bin, "udev", msg->subsystem, NULL, env);
                dbg("exec of child failed");
                exit(1);
                break;
@@ -460,6 +457,13 @@ int main(int argc, char *argv[])
        /* enable receiving of the sender credentials */
        setsockopt(ssock, SOL_SOCKET, SO_PASSCRED, &on, sizeof(on));
 
+       /* possible override of udev binary, used for testing */
+       udev_bin = getenv("UDEV_BIN");
+       if (udev_bin != NULL)
+               dbg("udev binary is set to '%s'", udev_bin);
+       else
+               udev_bin = UDEV_BIN;
+
        FD_ZERO(&readfds);
        FD_SET(ssock, &readfds);
        FD_SET(pipefds[0], &readfds);