summaryrefslogtreecommitdiff
path: root/src/journal
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-30 22:25:01 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-30 22:25:01 +0200
commitba1261bc02693ac8a7712ade14aab8e22989ba88 (patch)
tree879e047af8d2e73f96134b44ddfb70135c3f6635 /src/journal
parent7c0987d8129e4761d24c21bbc2e5d39731a6b7f0 (diff)
build-sys: fix built with --disable-logind
Diffstat (limited to 'src/journal')
-rw-r--r--src/journal/coredump.c9
-rw-r--r--src/journal/journald.c19
2 files changed, 21 insertions, 7 deletions
diff --git a/src/journal/coredump.c b/src/journal/coredump.c
index db805d6cb5..10897f3461 100644
--- a/src/journal/coredump.c
+++ b/src/journal/coredump.c
@@ -25,12 +25,16 @@
#include <sys/prctl.h>
#include <systemd/sd-journal.h>
+
+#ifdef HAVE_LOGIND
#include <systemd/sd-login.h>
+#endif
#include "log.h"
#include "util.h"
#include "mkdir.h"
#include "special.h"
+#include "cgroup-util.h"
#define COREDUMP_MAX (24*1024*1024)
@@ -126,7 +130,7 @@ int main(int argc, char* argv[]) {
goto finish;
}
- if (sd_pid_get_unit(pid, &t) >= 0) {
+ if (cg_pid_get_unit(pid, &t) >= 0) {
if (streq(t, SPECIAL_JOURNALD_SERVICE)) {
/* Make sure we don't make use of the journal,
@@ -182,6 +186,7 @@ int main(int argc, char* argv[]) {
if (core_comm)
IOVEC_SET_STRING(iovec[j++], core_comm);
+#ifdef HAVE_LOGIND
if (sd_pid_get_session(pid, &t) >= 0) {
core_session = strappend("COREDUMP_SESSION=", t);
free(t);
@@ -190,6 +195,8 @@ int main(int argc, char* argv[]) {
IOVEC_SET_STRING(iovec[j++], core_session);
}
+#endif
+
if (get_process_exe(pid, &t) >= 0) {
core_exe = strappend("COREDUMP_EXE=", t);
free(t);
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 5ecb7f72d3..8ce9ce858b 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -31,10 +31,13 @@
#include <sys/statvfs.h>
#include <systemd/sd-journal.h>
-#include <systemd/sd-login.h>
#include <systemd/sd-messages.h>
#include <systemd/sd-daemon.h>
+#ifdef HAVE_LOGIND
+#include <systemd/sd-login.h>
+#endif
+
#include "mkdir.h"
#include "hashmap.h"
#include "journal-file.h"
@@ -479,7 +482,9 @@ static void dispatch_message_real(
if (ucred) {
uint32_t audit;
+#ifdef HAVE_LOGIND
uid_t owner;
+#endif
realuid = ucred->uid;
@@ -538,6 +543,7 @@ static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], cgroup);
}
+#ifdef HAVE_LOGIND
if (sd_pid_get_session(ucred->pid, &t) >= 0) {
session = strappend("_SYSTEMD_SESSION=", t);
free(t);
@@ -546,7 +552,12 @@ static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], session);
}
- if (sd_pid_get_unit(ucred->pid, &t) >= 0) {
+ if (sd_pid_get_owner_uid(ucred->uid, &owner) >= 0)
+ if (asprintf(&owner_uid, "_SYSTEMD_OWNER_UID=%lu", (unsigned long) owner) >= 0)
+ IOVEC_SET_STRING(iovec[n++], owner_uid);
+#endif
+
+ if (cg_pid_get_unit(ucred->pid, &t) >= 0) {
unit = strappend("_SYSTEMD_UNIT=", t);
free(t);
@@ -554,10 +565,6 @@ static void dispatch_message_real(
IOVEC_SET_STRING(iovec[n++], unit);
}
- if (sd_pid_get_owner_uid(ucred->uid, &owner) >= 0)
- if (asprintf(&owner_uid, "_SYSTEMD_OWNER_UID=%lu", (unsigned long) owner) >= 0)
- IOVEC_SET_STRING(iovec[n++], owner_uid);
-
#ifdef HAVE_SELINUX
if (label) {
selinux_context = malloc(sizeof("_SELINUX_CONTEXT=") + label_len);