chiark / gitweb /
reset signal handler in event process
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index 4ed2f94bfc50c0a0f3d51dcc3b612c2b03b663ab..9340be14cfd219d3b05c52a848f97e64edd05c43 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -100,6 +100,13 @@ static int udev_event_process(struct uevent_msg *msg)
        act.sa_flags = 0;
        sigaction(SIGALRM, &act, NULL);
 
+       /* reset to default */
+       act.sa_handler = SIG_DFL;
+       sigaction(SIGINT, &act, NULL);
+       sigaction(SIGTERM, &act, NULL);
+       sigaction(SIGCHLD, &act, NULL);
+       sigaction(SIGHUP, &act, NULL);
+
        /* trigger timeout to prevent hanging processes */
        alarm(UDEV_ALARM_TIMEOUT);
 
@@ -117,9 +124,10 @@ static int udev_event_process(struct uevent_msg *msg)
        retval = udev_device_event(&rules, udev);
 
        /* run programs collected by RUN-key*/
-       if (retval == 0) {
+       if (retval == 0 && !udev->ignore_device && udev_run) {
                struct name_entry *name_loop;
 
+               dbg("executing run list");
                list_for_each_entry(name_loop, &udev->run_list, node) {
                        if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0)
                                pass_env_to_socket(&name_loop->name[strlen("socket:")], msg->devpath, msg->action);
@@ -199,6 +207,10 @@ static void export_event_state(struct uevent_msg *msg, enum event_state state)
                        if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0)
                                return;
 
+               list_for_each_entry(loop_msg, &exec_list, node)
+                       if (loop_msg->devpath && strcmp(loop_msg->devpath, msg->devpath) == 0)
+                               return;
+
                /* move failed events to the failed directory */
                if (state == EVENT_FAILED) {
                        create_path(filename_failed);
@@ -526,7 +538,6 @@ static struct uevent_msg *get_msg_from_envbuf(const char *buf, int buf_size)
                free(msg);
                return NULL;
        }
-
        return msg;
 }
 
@@ -580,7 +591,6 @@ static struct uevent_msg *get_udevd_msg(void)
 
        switch (usend_msg.type) {
        case UDEVD_UEVENT_UDEVSEND:
-       case UDEVD_UEVENT_INITSEND:
                info("udevd event message received");
                envbuf_size = size - offsetof(struct udevd_msg, envbuf);
                dbg("envbuf_size=%i", envbuf_size);