chiark / gitweb /
udevd: fix initial timeout handling
[elogind.git] / udevd.c
diff --git a/udevd.c b/udevd.c
index 3a8ac639bd68ec7a78c4cde51b614f073fffb2fc..5974d14e8ec6a84432209f5bcb7634674c1422eb 100644 (file)
--- a/udevd.c
+++ b/udevd.c
@@ -131,15 +131,6 @@ static void msg_queue_insert(struct uevent_msg *msg)
                        init_phase = 0;
        }
 
-       /* don't delay messages with timeout set */
-       if (msg->timeout) {
-               info("seq %llu with timeout %u seconds will be execute without queuing, '%s' '%s'",
-                    msg->seqnum, msg->timeout, msg->action, msg->devpath);
-               list_add(&msg->node, &exec_list);
-               run_exec_q = 1;
-               return;
-       }
-
        /* sort message by sequence number into list */
        list_for_each_entry_reverse(loop_msg, &msg_list, node) {
                if (loop_msg->seqnum < msg->seqnum)
@@ -204,7 +195,7 @@ static int running_processes(void)
        if (f == -1)
                return -1;
 
-       len = read(f, buf, sizeof(buf));
+       len = read(f, buf, sizeof(buf)-1);
        close(f);
 
        if (len <= 0)
@@ -253,7 +244,7 @@ static int running_processes_in_session(pid_t session, int limit)
                if (f == -1)
                        continue;
 
-               len = read(f, line, sizeof(line));
+               len = read(f, line, sizeof(line)-1);
                close(f);
 
                if (len <= 0)
@@ -419,8 +410,9 @@ recheck:
 
                /* limit timeout during initialization phase */
                if (init_phase) {
-                       timeout = UDEVD_INIT_EVENT_TIMEOUT;
-                       dbg("initialization phase, limit timeout to %i seconds", UDEVD_INIT_EVENT_TIMEOUT);
+                       if (timeout > UDEVD_INIT_EVENT_TIMEOUT)
+                               timeout = UDEVD_INIT_EVENT_TIMEOUT;
+                       dbg("initialization phase, timeout %i seconds", timeout);
                }
 
                /* move event with expired timeout to the exec list */