chiark / gitweb /
def: centralize definition of default timeout in one place
[elogind.git] / src / manager.c
index 1ab4c94eefa40978812475872b649de870dcee3c..9edb8f09bbc990abc41e9904b71f6291e7ea0f75 100644 (file)
@@ -2057,6 +2057,8 @@ static int manager_process_signal_fd(Manager *m) {
         assert(m);
 
         for (;;) {
+                char *p = NULL;
+
                 if ((n = read(m->signal_watch.fd, &sfsi, sizeof(sfsi))) != sizeof(sfsi)) {
 
                         if (n >= 0)
@@ -2068,7 +2070,13 @@ static int manager_process_signal_fd(Manager *m) {
                         return -errno;
                 }
 
-                log_debug("Received SIG%s", strna(signal_to_string(sfsi.ssi_signo)));
+                if (sfsi.ssi_pid > 0)
+                        get_process_name(sfsi.ssi_pid, &p);
+
+                log_debug("Received SIG%s from PID %lu (%s)",
+                          strna(signal_to_string(sfsi.ssi_signo)),
+                          (unsigned long) sfsi.ssi_pid, strna(p));
+                free(p);
 
                 switch (sfsi.ssi_signo) {
 
@@ -2448,8 +2456,19 @@ void manager_send_unit_audit(Manager *m, Unit *u, int type, bool success) {
                 return;
         }
 
-        if (audit_log_user_comm_message(m->audit_fd, type, "", p, NULL, NULL, NULL, success) < 0)
-                log_error("Failed to send audit message: %m");
+        if (audit_log_user_comm_message(m->audit_fd, type, "", p, NULL, NULL, NULL, success) < 0) {
+                log_warning("Failed to send audit message: %m");
+
+                if (errno == EPERM) {
+                        /* We aren't allowed to send audit messages?
+                         * Then let's not retry again, to avoid
+                         * spamming the user with the same and same
+                         * messages over and over. */
+
+                        audit_close(m->audit_fd);
+                        m->audit_fd = -1;
+                }
+        }
 
         free(p);
 #endif
@@ -2824,7 +2843,8 @@ void manager_check_finished(Manager *m) {
 
         dual_timestamp_get(&m->finish_timestamp);
 
-        if (m->running_as == MANAGER_SYSTEM) {
+        if (m->running_as == MANAGER_SYSTEM && detect_container(NULL) <= 0) {
+
                 if (dual_timestamp_is_set(&m->initrd_timestamp)) {
                         log_info("Startup finished in %s (kernel) + %s (initrd) + %s (userspace) = %s.",
                                  format_timespan(kernel, sizeof(kernel),