[systemd-devel] [PATCH 6/7] core/execute: honour !HAVE_UTMP

Emil Renner Berthing systemd at esmil.dk
Wed Sep 24 08:25:05 PDT 2014


---
 src/core/execute.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/core/execute.c b/src/core/execute.c
index e27cc7a..001bc33 100644
--- a/src/core/execute.c
+++ b/src/core/execute.c
@@ -69,7 +69,6 @@
 #include "namespace.h"
 #include "exit-status.h"
 #include "missing.h"
-#include "utmp-wtmp.h"
 #include "def.h"
 #include "path-util.h"
 #include "env-util.h"
@@ -84,6 +83,10 @@
 #include "bus-kernel.h"
 #include "label.h"
 
+#ifdef HAVE_UTMP
+#include "utmp-wtmp.h"
+#endif
+
 #ifdef HAVE_SECCOMP
 #include "seccomp-util.h"
 #endif
@@ -1410,8 +1413,10 @@ static int exec_child(ExecCommand *command,
                         return -errno;
                 }
 
+#ifdef HAVE_UTMP
         if (context->utmp_id)
                 utmp_put_init_process(context->utmp_id, getpid(), getsid(0), context->tty_path);
+#endif
 
         if (context->user) {
                 username = context->user;
@@ -2418,9 +2423,10 @@ void exec_status_exit(ExecStatus *s, ExecContext *context, pid_t pid, int code,
         s->status = status;
 
         if (context) {
+#ifdef HAVE_UTMP
                 if (context->utmp_id)
                         utmp_put_dead_process(context->utmp_id, pid, code, status);
-
+#endif
                 exec_context_tty_reset(context);
         }
 }
-- 
2.1.0



More information about the systemd-devel mailing list