chiark / gitweb /
journal: Leave server_dispatch_message early when Storage is none
[elogind.git] / src / journal / journald-server.c
index 44ba916f1045d56f262f9d9385afc206a2c03ae1..81de9596664bca69d627067ed95862ae3067720f 100644 (file)
@@ -578,6 +578,13 @@ static void dispatch_message_real(
                         IOVEC_SET_STRING(iovec[n++], x);
                 }
 
+                r = get_process_capeff(ucred->pid, &t);
+                if (r >= 0) {
+                        x = strappenda("_CAP_EFFECTIVE=", t);
+                        free(t);
+                        IOVEC_SET_STRING(iovec[n++], x);
+                }
+
 #ifdef HAVE_AUDIT
                 r = audit_session_from_pid(ucred->pid, &audit);
                 if (r >= 0) {
@@ -838,6 +845,11 @@ void server_dispatch_message(
         if (LOG_PRI(priority) > s->max_level_store)
                 return;
 
+        /* Stop early in case the information will not be stored
+         * in a journal. */
+        if (s->storage == STORAGE_NONE)
+                return;
+
         if (!ucred)
                 goto finish;
 
@@ -910,11 +922,12 @@ static int system_journal_open(Server *s) {
 
                 if (r >= 0)
                         server_fix_perms(s, s->system_journal, 0);
-        } else if (r < 0) {
-                if (r != -ENOENT && r != -EROFS)
-                        log_warning("Failed to open system journal: %s", strerror(-r));
+                else if (r < 0) {
+                        if (r != -ENOENT && r != -EROFS)
+                                log_warning("Failed to open system journal: %s", strerror(-r));
 
-                r = 0;
+                        r = 0;
+                }
         }
 
         if (!s->runtime_journal &&