[systemd-commits] 2 commits - configure.ac src/execute.c src/service.c

Lennart Poettering lennart at kemper.freedesktop.org
Tue Jul 6 20:03:23 PDT 2010


 configure.ac  |    2 +-
 src/execute.c |   14 +++++++-------
 src/service.c |    1 +
 3 files changed, 9 insertions(+), 8 deletions(-)

New commits:
commit afe1be4dbdf142513f6ac1d92e6a20bdc4b20c80
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 04:45:21 2010 +0200

    build-sys: prepare release 1

diff --git a/configure.ac b/configure.ac
index cb41916..3bdd1dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,7 +17,7 @@
 
 AC_PREREQ(2.63)
 
-AC_INIT([systemd],[0],[systemd-devel at lists.freedesktop.org])
+AC_INIT([systemd],[1],[systemd-devel at lists.freedesktop.org])
 AC_CONFIG_SRCDIR([src/main.c])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_HEADERS([config.h])
commit acb591e4523af82be3d76fde342e91c90a4bed38
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Jul 7 04:37:42 2010 +0200

    execute: change stdout inherit logic, when run as PID 1 use /dev/null

diff --git a/src/execute.c b/src/execute.c
index 2acb111..d7239d5 100644
--- a/src/execute.c
+++ b/src/execute.c
@@ -305,16 +305,16 @@ static int setup_output(const ExecContext *context, int socket_fd, const char *i
 
         case EXEC_OUTPUT_INHERIT:
 
-                /* If the input is connected to a terminal, inherit that... */
+                /* If the input is connected to anything that's not a /dev/null, inherit that... */
                 if (i != EXEC_INPUT_NULL)
                         return dup2(STDIN_FILENO, STDOUT_FILENO) < 0 ? -errno : STDOUT_FILENO;
 
-                /* For PID 1 stdout is always connected to /dev/null,
-                 * hence reopen the console if out parent is PID1. */
-                if (getppid() == 1)
-                        return open_terminal_as(tty_path(context), O_WRONLY, STDOUT_FILENO);
+                /* If we are not started from PID 1 we just inherit STDOUT from our parent process. */
+                if (getppid() != 1)
+                        return STDOUT_FILENO;
 
-                return STDOUT_FILENO;
+                /* We need to open /dev/null here anew, to get the
+                 * right access mode. So we fall through */
 
         case EXEC_OUTPUT_NULL:
                 return open_null_as(O_WRONLY, STDOUT_FILENO);
@@ -356,7 +356,7 @@ static int setup_error(const ExecContext *context, int socket_fd, const char *id
          * the way and are not on a tty */
         if (e == EXEC_OUTPUT_INHERIT &&
             o == EXEC_OUTPUT_INHERIT &&
-            i != EXEC_INPUT_NULL &&
+            i == EXEC_INPUT_NULL &&
             getppid () != 1)
                 return STDERR_FILENO;
 
diff --git a/src/service.c b/src/service.c
index ecfd054..9086590 100644
--- a/src/service.c
+++ b/src/service.c
@@ -686,6 +686,7 @@ static int service_load_sysv_path(Service *s, const char *path) {
         s->valid_no_process = true;
         s->kill_mode = KILL_PROCESS_GROUP;
         s->restart = SERVICE_ONCE;
+        s->exec_context.std_output = EXEC_OUTPUT_TTY;
 
         u->meta.load_state = UNIT_LOADED;
         r = 0;


More information about the systemd-commits mailing list