chiark / gitweb /
journal: add logging of effective capabilities _CAP_EFFECTIVE
[elogind.git] / src / journal / journald-server.c
index 44ba916f1045d56f262f9d9385afc206a2c03ae1..332ba41363e842293bf99b590f31daa87ca78cb2 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) {
@@ -910,11 +917,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 &&