chiark / gitweb /
[PATCH] change default perms of misc/rtc to be readable by anyone.
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index b2cb62f386c4d7a7b0383161fe629dad963e7eb1..e0c5bf5c779789f10d2faf0714dc812dacd0fa6f 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];
@@ -146,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;
@@ -307,9 +306,10 @@ skip:
        return;
 }
 
-static void sig_handler(int signum)
+__attribute__((regparm(0))) static void sig_handler(int signum)
 {
        int rc;
+
        switch (signum) {
                case SIGINT:
                case SIGTERM:
@@ -326,7 +326,7 @@ static void sig_handler(int signum)
                        goto do_write;
                        break;
                default:
-                       dbg("unhandled signal");
+                       dbg("unhandled signal %d", signum);
                        return;
        }
        
@@ -458,6 +458,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);